标签:python cts public 工具 creat 配置 接下来 dock 数据
yum install -y epel-release
yum install -y python-pip python-devel gcc
pip install --upgrade pip
pin install docker-compose
使用docker-compose方式,先创建一个docker-compose.yml文件,内容如下:
version: ‘3‘
services:
redis1:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8001/data:/data
environment:
- REDIS_PORT=8001
redis2:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8002/data:/data
environment:
- REDIS_PORT=8002
redis3:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8003/data:/data
environment:
- REDIS_PORT=8003
redis4:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8004/data:/data
environment:
- REDIS_PORT=8004
redis5:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8005/data:/data
environment:
- REDIS_PORT=8005
redis6:
image: publicisworldwide/redis-cluster
network_mode: host
restart: always
volumes:
- /data/redis/8006/data:/data
environment:
- REDIS_PORT=8006
docker-compose up -d
docker-compose ps
如果在这里要重新初始化,可以 docker-compose up stop 后,删除 volumes 配置的对应数据目录,然后 docker-compose up -d 重新启动,然后初始化
docker run --rm -it inem0o/redis-trib create --replicas 1 172.19.165.222:8001 172.19.165.222:8002 172.19.165.222:8003 172.19.165.222:8004 172.19.165.222:8005 172.19.165.222:8006
接下来就可以使用 Redis Desktop Manager 等工具连接了,记得要取消勾选 change host on cluster redirects:
参考链接(
https://www.runoob.com/docker/docker-redis-cluster.html
https://www.jianshu.com/p/b7dea62bcd8b
)
docker 搭建 redis 集群(Redis-Cluster集群)
标签:python cts public 工具 creat 配置 接下来 dock 数据
原文地址:https://www.cnblogs.com/daleyzou/p/docker-redis-cluster.html