docker redis 集群
- 拉取redis镜像
docker pull redis
- 创建文件夹
mkdir -p /data/logs mkdir -p /data/redis touch /data/redis/redis.conf touch /data/logs/redis.log
- 下载redis.conf 修改后替换到 /data/redis/redis.conf
设置ip bind 0.0.0.0设置密码(可以不设) requirepass dust1234设置集群帐号(必须设置) masterauth dust1234设置日志文件路径 logfile “/data/logs/redis.log”设置集群配置 cluster-enabled yes设置集群配置文件 cluster-config-file nodes-6379.conf设置集群超时时间 cluster-node-timeout 15000
- 构建镜像
FROM redis COPY redis.conf /data/redis/redis.conf #替换redis默认配置RUN chmod 777 /data/redis/redis.conf #设置权限 EXPOSE 6379 CMD [ "redis-server", "/data/redis/redis.conf" ]
- 运行docker
docker run -d --name conf-6379 -p 6379:6379 redis:v1.0 docker run -d --name conf-6381 -p 6381:6379 redis:v1.0 docker run -d --name conf-6381 -p 6381:6379 redis:v1.0 docker run -d --name conf-6382 -p 6382:6379 redis:v1.0 docker run -d --name conf-6383 -p 6383:6379 redis:v1.0 docker run -d --name conf-6384 -p 6384:6379 redis:v1.0
- 然后下载RedisDesktopManager验证集群
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04