I want to set up master-slave redis in docker container; And I want to use redis.conf in slave's container;
Test environment :win7+Docker Quickstart Terminal;
Before start,Create three file redis-6379、redis-6380、redis-6381 to this path: '~/Desktop/redis/';Then create redis.conf foreach file;(Using the official configuration);Then use Docker Quickstart run command :
cp -rf ~/Desktop/redis/ /usr/local/
I do this in the fllowing steps:
1、modify redis.conf (redis-6381/redis-6380)
slaveof 172.17.0.2 6379
2、specify this redis.conf
docker run -v /usr/local/redis/redis-6381/redis.conf:/usr/local/etc/redis/redis.conf --name redis-6381 -p 6381:6379 -d redis redis-server /usr/local/etc/redis/redis.conf
docker logs gives me: Configuration loaded;Actually redis.conf has no effect; info replication show,this redis still be a master role;
Then,I tried in this way,it works:
docker run --name redis-6381 -p 6381:6379 -d redis redis-server slaveof 172.17.0.2 6379
So,why redis.conf cann't work ?
/usr/local/etc/redis/redis.conf
has theslaveof
value or not? – Tarun Lalwani/usr/local/redis/redis-6381/redis.conf
on your host machine doesn't exists – Tarun Lalwani