环境:WIN10 Docker Desktop
部署命令:/E windows盘符E
docker run -p 6003:6379 --name redis_v3 -v /E/Docker/redis_3/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:v3
docker run -p 6002:6379 --name redis_v2 -v /E/Docker/redis_2/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:v2
docker run -p 6001:6379 --name redis_v1 -v /E/Docker/redis_1/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:v1
windows上不能添加data文件夹映射 否则从库提示 Failed load the MASTER synchronization DB from..
错误示例
docker run -p 6003:6379 --name redis_v3 -v /E/Docker/redis_3/conf/redis.conf:/usr/local/etc/redis/redis.conf -v /E/Docker/redis_3/data:/data -d redis:v3
docker run -p 6002:6379 --name redis_v2 -v /E/Docker/redis_2/conf/redis.conf:/usr/local/etc/redis/redis.conf -v /E/Docker/redis_2/data:/data -d redis:v2
docker run -p 6001:6379 --name redis_v1 -v /E/Docker/redis_1/conf/redis.conf:/usr/local/etc/redis/redis.conf -v /E/Docker/redis_1/data:/data -d redis:v1
主从查看 设置命令
设置主库地址 SLAVEOF 172.17.0.4 6379
查看从库 info replication
docker inspect 容器ID 查看容器IP