当前位置:网站首页>Docker deploy redis cluster
Docker deploy redis cluster
2022-06-27 02:15:00 【Operation and maintenance @ small soldier】
List of articles
One 、 establish redis_cluster bridge
docker network create redis_cluster --subnet=172.38.1.0/24 -o com.docker.network.bridge.name=redis_cluster
ifconfig redis_cluster

Two 、 Start six containers
Two containers in a group , One master, One slave,master Hang up ,slave It's going to be master
for port in $(seq 1 6); \
do \
mkdir -p /mydata/redis/node-${port}/conf
touch /mydata/redis/node-${port}/conf/redis.conf
cat << EOF >/mydata/redis/node-${port}/conf/redis.conf port 6379 bind 0.0.0.0 cluster-enabled yes # Start cluster mode cluster-config-file nodes.conf # Cluster node information file cluster-node-timeout 5000 #redis The time when the node outage was discovered cluster-announce-ip 172.38.1.1${port} # Report of cluster nodes ip, prevent nat, Here is docker Containers IP cluster-announce-port 6379 # Report of cluster nodes port, prevent nat cluster-announce-bus-port 16379 # Report of cluster nodes bus-port, prevent nat appendonly yes # Turn on aof Persistence EOF
# Start at one time through script 6 individual redis Containers
docker run -p 637${port}:6379 -p 1637${port}:16379 --name redis-${port} \
-v /mydata/redis/node-${port}/data:/data \
-v /mydata/redis/node-${port}/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis_cluster --ip 172.38.1.1${port} redis:6.0 redis-server /etc/redis/redis.conf
done
3、 ... and 、 Create clusters
docker exec -it redis-1 bash
redis-cli --cluster create 172.38.1.11:6379 172.38.1.12:6379 172.38.1.13:6379 172.38.1.14:6379 172.38.1.15:6379 172.38.1.16:6379 --cluster-replicas 1
redis-cli -c # Enter the cluster
cluster info # View cluster information

cluster nodes

Four 、 Uninstall the cluster
for port in $(seq 1 6); do docker rm -f redis-${port}; done
rm -rf /mydata/redis
5、 ... and 、 Reference article
边栏推荐
- P5.js death planet
- bluecms代码审计入门
- Is the division of each capability domain of Dama, dcmm and other data management frameworks reasonable? Is there internal logic?
- Flink學習2:應用場景
- memcached基础15
- XSS attack (note)
- Look! In June, 2022, the programming language ranking list was released! The first place is awesome
- memcached基礎12
- Oracle/PLSQL: Soundex Function
- memcached基础12
猜你喜欢

Some exception handling for idea plug-in development

TechSmith Camtasia最新2022版详细功能讲解下载

宁愿去996也不要待业在家啦!24岁,失业7个月,比上班更惨的,是没班可上

I earned 3W yuan a month from my sideline: the industry you despise really makes money!

docker部署redis集群

Press key to control LED status reversal

Detailed explanation of ThreadLocal

“所有专业都在劝退”,对大学生最友好的竟然是它?

Summer planning for the long river

DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?
随机推荐
Some exception handling for idea plug-in development
Oracle/PLSQL: Lpad Function
lottie. JS creative switch button animal head
paddlepaddle 20 指数移动平均(ExponentialMovingAverage,EMA)的实现与使用(支持静态图与动态图)
lottie.js创意开关按钮动物头像
我靠副业一个月挣了3W块:你看不起的行业,真的很挣钱!
Detailed explanation of ThreadLocal
Flink学习4:flink技术栈
TechSmith Camtasia最新2022版详细功能讲解下载
p5.js死亡星球
Oracle/PLSQL: From_ Tz function
three.js多米诺骨牌js特效
Why divide the training set and the test set before normalization?
Oracle/PLSQL: CharToRowid Function
达梦数据库安装
学习太极创客 — MQTT 第二章(一)QoS 服务质量等级
执念斩长河暑期规划
Oracle/PLSQL: VSize Function
Memcached foundation 10
C语言--职工信息管理系统设计