当前位置:网站首页>Docker deploys a redis cluster
Docker deploys a redis cluster
2022-06-10 14:20:00 【java_ prinln】
Docker Deploy a Redis colony
Fragmentation + High availability + Load balancing

Create a network card
docker network create redis --subnet 172.38.0.0/16
Create six by script redis To configure
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 cluster-config-file nodes.conf cluster-node-timeout 5000 cluster-announce-ip 172.38.0.1${port} cluster-announce-port 6379 cluster-announce-bus-port 16379 appendonly yes EOF
done
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 --ip 172.38.0.1${port} redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf; \
# start-up 6 A container
docker run -p 6371:6379 -p 16371:16379 --name redis-1 \
-v /mydata/redis/node-1/data:/data \
-v /mydata/redis/node-1/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.11 redis:5.0.9-alpine3.11 redis-server
/etc/redis/redis.conf
docker run -p 6376:6379 -p 16376:16379 --name redis-6 \
-v /mydata/redis/node-6/data:/data \
-v /mydata/redis/node-6/conf/redis.conf:/etc/redis/redis.conf \
-d --net redis --ip 172.38.0.16 redis:5.0.9-alpine3.11 redis-server
/etc/redis/redis.conf
Enter a redis, Notice that this is sh command
docker exec -it redis-1 /bin/sh
Create clusters
redis-cli --cluster create 172.38.0.11:6379
172.38.0.12:6379 172.38.0.13:6379 172.38.0.14:6379 172.38.0.15:6379 172.38.0.16:6379 --
cluster-replicas 1
Connect clusters
redis-cli -c
View cluster information
cluster info
Look at the node
cluster nodes
set a b
Stop to the value storage container
Then again, get a, It is found that the value can still be obtained
Look at the node , There is no problem finding high availability
边栏推荐
- QT interface nested movement based on qscrollarea
- CVPR 2022 Oral | SCI:实现快速、灵活与稳健的低光照图像增强
- 数仓的基本概念
- Net core Tianma XingKong series - Interface Implementation for dependency injection and mutual conversion of database tables and C entity classes
- [discrete mathematics review series] IV. figure
- Allan方差与随机误差辨识
- 软件智能:aaas系统 度量衡及文法的形式规则
- 【离散数学期复习系列】六、树
- [discrete mathematics review series] i. propositional logic
- [original] poi 5 X xssf and HSSF use custom font colors
猜你喜欢

【大咖秀】博睿数据眼中的AIOps,选择正确的赛道正确的人

2022 practice questions and online simulation test for the third batch of Guangdong Provincial Safety Officer a certificate (principal)

2022 examination question bank and online simulation examination for main principals of hazardous chemical business units

SIGIR 2022 | 港大、武大提出KGCL:基于知识图谱对比学习的推荐系统

Main features of IIC bus / communication process / read / write process

Win10 virtual machine download and installation process

Allan方差与随机误差辨识

Simulated 100 questions and online simulated examination for safety production management personnel of hazardous chemical production units in 2022
![[Discrete Mathematical period Review Series] Second and first order Logic (precate Logic)](/img/f3/c7e61462a012ca1b88dca7b1ecdb25.png)
[Discrete Mathematical period Review Series] Second and first order Logic (precate Logic)

【離散數學期複習系列】二、一階邏輯(謂詞邏輯)
随机推荐
.NET C#基础(7):接口 - 人如何和猫互动
2022危险化学品经营单位主要负责人考试题库及在线模拟考试
Textinputlayout usage details
Kotlin bubbling algorithm, Gaud map filters out the data whose distance between two points is less than 50, and does not repeat the display
Gin blog summary 1
P3379 [template] nearest common ancestor (LCA)
[notes] notes on C language array pointer, structure + two-dimensional array pointer
2022广东省安全员A证第三批(主要负责人)考试练习题及在线模拟考试
[discrete mathematics review series] IV. figure
【离散数学期复习系列】六、树
Flutter Listview, Column, Row学习个人总结2
anaconda安装opencv(cv2),在jupyter notebook中使用
22.6.7 successfully use doc2vec model to generate embedded vectors
Is it safe to open an account in qiniu
How to build Haojing technology when the computing power network is brought into reality?
自适应功能简略
Gin blog 总结1
C#多线程学习笔记一
2022年危险化学品生产单位安全生产管理人员考试模拟100题及在线模拟考试
C#多线程学习笔记四