Redis主从复制
https://blog.csdn.net/qq_36850813/article/details/91350727
https://www.jianshu.com/p/5556b6d2f93e
https://cloud.tencent.com/developer/article/1474195
相关说明
1 必须先将redis.conf配置文件放入宿主机的conf目录下,否则执行docker run会创建redis.conf目录,配置失效 2 3 docker run -d --name "redis203" --privileged=true -p 6379:6379 --restart always -v /usr/local/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/redis/data:/data redis:latest redis-server /etc/redis/redis.conf --appendonly yes 4 5 docker run -d --name "redis-slave01" --privileged=true -p 6380:6379 --restart always -v /usr/local/docker/redis-cluster/slave01/conf/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/redis-cluster/slave01/data:/data redis:latest redis-server /etc/redis/redis.conf --appendonly yes 6 docker run -d --name "redis-slave02" --privileged=true -p 6381:6379 --restart always -v /usr/local/docker/redis-cluster/slave02/conf/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/redis-cluster/slave02/data:/data redis:latest redis-server /etc/redis/redis.conf --appendonly yes 7 8 docker exec -it redis-slave01 redis-cli -a 123456
其中
masterauth 123456
配置的是 主服务器的密码,requirepass是自己的密码,192.168.111.111
是主服务器的IP ,docker模式下设置 daemonize yes
无法启动,所以不设置该项。