Linux – How do I name an instance of redis

How do I name an instance of redis… here is a solution to the problem.

How do I name an instance of redis

I’ve launched two instances of Redis. Shown below is the command to start a Redis instance.

service redis start
service redis2 start

For redis, using the default port, I have started redis2 with port 6380. If I want to use the same redis-cli for the default port, I need to provide redis -p 6380 for the redis2 instance.

Can I have Redis instances launch with a name so that I can easily identify what each instance will do? ps -aef is shown below.

ps -awef| grep redis
redis    11498     1  0 09:30 ?        00:00:02 /usr/bin/redis-server 127.0.0.1:6379
redis    13285     1  0 10:00 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6380

Solution

Make each Redis instance different for the user.

ps -awef| grep redis
redis     11498     1  0 09:30 ?        00:00:02 /usr/bin/redis-server 127.0.0.1:6379
redis2    13285     1  0 10:00 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6380

Related Problems and Solutions