(The Basics of redis installation, configuration, and login are no longer mentioned. There are a lot of information on the Internet. Here I only talk about my understanding and configuration of multiple redis instances)
My own redis version is 2.8.13 and the environment is ubuntu.
My personal understanding of multiple instances is as follows:
Use QQ as an example. Double-click it to open a QQ interface. Whether or not it is logged in, a QQ process is started. If you want to open another QQ, you need to double-click to open a QQ;
Similarly, in redis, a Linux port can only provide one service at a time. To open two redis instances, you must first set different ports for redis.
There are several other items that need to be listed as follows:
Copy a new configuration file
You can copy redis. conf from the redis installation directory, for example, redis_new_instance.conf.
Open redis_new_instance.conf
Modify the following configurations:
If daemonize is set to yes, redis is run in the background.
Pidfile indicates the process PID recorded by redis by default when redis is running in the background, for example,/var/run/redis_zhl.pid.
The new port must be changed to a new port, such as 6380.
Logfile refers to the redis log file path such as "/tmp/redis_zhl.log"
Dbfilename refers to the location of the persistent data file (if you do not modify this option from the previous redis instance, the data you see is the same) for example, I set it to dump_zhl.rdb
Okay. Set OK to open a new redis instance.
./Redis-server ../redis_new_instance.conf
Client Access
Redis-cli-H 127.0.0.1-P 6380
Redis multi-instance Configuration