下载redis 3.2镜像
#docker pull redis:3.2

docker run -d -ti --net host --name 6379 \
-v /usr/local/redis/data6379:/data \
-v /usr/local/redis/redis6379.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

docker run -d -ti --net host --name 6380 \
-v /usr/local/redis/data6380:/data \
-v /usr/local/redis/redis6380.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

docker run -d -ti --net host --name 6381 \
-v /usr/local/redis/data6381:/data \
-v /usr/local/redis/redis6381.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

docker run -d -ti --net host --name 6382 \
-v /usr/local/redis/data6382:/data \
-v /usr/local/redis/redis6382.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

docker run -d -ti --net host --name 6383 \
-v /usr/local/redis/data6383:/data \
-v /usr/local/redis/redis6383.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

docker run -d -ti --net host --name 6384 \
-v /usr/local/redis/data6384:/data \
-v /usr/local/redis/redis6384.conf:/usr/local/redis/redis.conf \
docker.io/redis:3.2 \
redis-server /usr/local/redis/redis.conf

主6379 6382
主6380 6383
主6381 6384

创建集群

./redis-trib.rb create --replicas 1 172.16.0.11:6379 172.16.0.11:6380 172.16.0.11:6381 172.16.0.14:6382 172.16.0.14:6383 172.16.0.14:6384

设置redis密码,搭建集群后,在所有redis节点执行以下命令
./redis-cli -h 172.16.0.* -p 6379
config set requirepass **