Redis-stack-server slave configuration for replication

192 views Asked by At

new to open source redis so if this question is fundamentally wrong let me know how to fix it.

I installed redis-server and was able to follow the documentation as well as some other online resources and was able to setup a master -> slave 1/2 configuration to simulate replication on a linux VM. I did this by making 3 redis.conf files changing the following:

line 98 port numbers: 6379, 6780, 6381 line 304 log file locations line 433 dbfiledump names for the salves line 479 replicaof 127.0.0.1 6379

I then used the following commands to start the services:

./redis-server /etc/redis/redis-master/redis.conf &

./redis-server /etc/redis/redis-slave1/redis.conf &

./redis-server /etc/redis/redis-slave2/redis.conf &

It worked but then I realized that this version of redis doesn't come with modules and there is another product called redis-stack-server that already has all the modules Im interested in installed and ready to go. So I download the binaries and installed that. I ran into an issue because I thought I could start this the same way I started redis-server above. However, after trying ./redis-stack-server /etc/redis/redis-master/redis.conf & it gave me an error:

>>> 'dir "../var/db/redis-stack"' No such file or directory

So I place the master conf file in the location it specified and I was able to startup the master. When trying to start up slave1 and slave2 Im not sure what to do since I cannot specify a different conf file to boot from, it always tries to go to ../var/db/redis-stack. This is an issue because I can only have 1 file in there called redis.conf, but the replicas need to boot with other conf files to my understanding.

So my question is how can I achieve the same setup I did for redis-server with redis-stack-server?

Thanks in advance

1

There are 1 answers

0
user14488986 On BEST ANSWER

Turns out ./redis-stack-server /etc/redis/redis-master/redis.conf & does actually work but the error was not very clear.

I discovered that in the redis.conf file I tried to specify the location for persistence storage in this line:

# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./

I had changed it to another location but it seems it doesn't like that and it has to be ./. After realizing this I was able to not only start up a redis stack server from the custom conf file but also the replication nodes as well.