当前位置:网站首页>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
边栏推荐
- dat.gui.js星星圆圈轨迹动画js特效
- Memcached foundation 10
- Memcached foundations 12
- Flink学习3:数据处理模式(流批处理)
- D's appendto packaging
- Would rather go to 996 than stay at home! 24 years old, unemployed for 7 months, worse than work, no work
- dat. gui. JS star circle track animation JS special effect
- 热议:月薪1.8万却毫无意义的工作,你干吗?
- mmdetection ValueError: need at least one array to concatenate解决方案
- XSS attack (note)
猜你喜欢

Google began to roll itself, AI architecture pathways was blessed, and 20billion generation models were launched

Summer planning for the long river

达梦数据库安装

Constraintlayout Development Guide

Canvas particles: mouse following JS effect

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

Flink Learning 2: Application Scenarios

DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?

dat. gui. JS star circle track animation JS special effect

Press key to control LED status reversal
随机推荐
Canvas particles: mouse following JS effect
svg拖拽装扮Kitty猫
paddlepaddle 19 动态修改模型的最后一层
“所有专业都在劝退”,对大学生最友好的竟然是它?
bluecms代码审计入门
Would rather go to 996 than stay at home! 24 years old, unemployed for 7 months, worse than work, no work
Oracle/PLSQL: Trim Function
Introduction to stm32
Oracle/PLSQL: NumToYMInterval Function
I earned 3W yuan a month from my sideline: the industry you despise really makes money!
How does the C # TCP server limit the number of connections to the same IP?
Memcached basics 14
Memcached Foundation 12
执念斩长河暑期规划
H5 liquid animation JS special effect code
Hot discussion: what are you doing for a meaningless job with a monthly salary of 18000?
Precautions for using sneakemake
Flink learning 5: how it works
宁愿去996也不要待业在家啦!24岁,失业7个月,比上班更惨的,是没班可上
Oracle/PLSQL: Rpad Function