image.png所以最少6个容器
    image.png
    然后看一下 redis 这个网络
    image.png

    用shell脚本写入配置
    image.png

    1. 然后一个一个启动redis 容器
    2. 外部 6371 容器内部6379 ,做个映射
    3. 外部 16371 容器内部16379 ,做个映射
    4. --name redis-1 这个redis1节点叫 redis-1
    5. -v 宿主机目录: '/mydata/redis/node-1/data' 容器目录: '/data'
    6. -v 宿主机目录: '/mydata/redis/node-1/conf/redis.conf' 容器目录: '/etc/redis/redis.conf'
    7. -d 后台运行
    8. --net 网络是用自己的网络 redis
    9. --ip 绑定的ip
    10. redis:5.0.9-alpine3.11 用这个redis版本
    11. 通过配置文件启动服务 redis-server /etc/redis/redis.conf

    image.png

    然后多开启几个节点 redis 1,2,3,4,5,6 ….
    image.png

    启动了6个节点
    image.pngimage.png
    查看集群image.png