Redis needs to be installed during Workerman development to store User IP, port information, etc.
First, install Redis in Ubuntu:
apt-update //更新apt包源apt-get install redis-server //安装redis-server
You can start Redis directly after the installation is complete:
redis-server
Redis starts the default configuration file since it is not followed by a boot profile
And then we'll take a look at the Redis file distribution
dpkg -L redis-server
From the top down several key files:
/etc/init.d/redis-server-------------Redis Executable program
/etc/redis/redis.conf----------------Redis configuration file
/usr/bin/redis-server---------------Redis self-boot files
If you're running Redis on a single instance, then there's no need to worry about it, so if you want to run multiple instances of Redis, you need to work with Redis files.
First we need to know that a Redis instance is a node, each node is assigned a port number, and each node corresponds to a redis.conf configuration file.
The port number for the Redis default configuration is 6379, assuming you now want to configure more than one 6380, we can directly copy redis.conf named Redis6380.conf, and edit the configuration file
cp /etc/redis/redis.conf /etc/redis/redis6380.confvi /etc/redis/redis6380.conf
Several parameters need to be modified
pidfile //run/redis/redis6380-~//log/redis/redis6380-~
Then save it and start the configuration file directly.
redis-server /etc/redis/redis6380.conf
We can view the next process
ps auxf | grep redis-server
The discovery did start with two Redis ports, but the two Redis process users were different, one redis and one root. If you want users to be redis, we can directly copy the/etc/init.d/redis-server self-boot file and modify the parameters
cp /etc/init.d/redis-server /etc/init.d/redis6380vi /etc/init.d/redis6380
Then quit restarting redis6380.conf to see the process
It's normal now!
Linux--redis installation and configuration and opening of multiple ports