当前位置:网站首页>Redis one master multi slave cluster setup
Redis one master multi slave cluster setup
2022-06-28 07:34:00 【Huangyuewang】
Basic concepts :
Single Redis If it goes down for some reason , May lead to Redis Service not available , Master-slave replication can be used to realize one master and multiple slaves , The master node is responsible for Write The operation of , Slave node responsible read The operation of , Data is periodically synchronized from the master node to the slave node , The problem of ensuring data consistency .

One The cluster is built in a tree mode
1. Here's the picture , Get ready 7 Servers , Master node (master) IP by 192.168.1.100

2. Cluster building
a. 192.168.1.100 Master node (master) No configuration required
After all slave nodes are configured , Use info replication You can see At present role: master Master node , multiple slave It's its slave node

b. 192.168.1.101 and 192.168.1.102 Configure slave
vim redis.config
increase slaveof Point to master node
Add the primary node password
Related configuration redis.conf
# replicaof <masterip> <masterport>
slaveof 192.168.1.100 6379
#redis password
masterauth 123456 info replication View cluster information , You can see the current role role: slave

c. 192.168.1.201 and 192.168.1.301 Configure slave
Related configuration redis.conf
# replicaof <masterip> <masterport>
slaveof 192.168.1.101 6379
#redis password
masterauth 123456 d. 192.168.1.202 and 192.168.1.302 Configure slave
Related configuration redis.conf
# replicaof <masterip> <masterport>
slaveof 192.168.1.102 6379
#redis password
masterauth 123456 Configuration is complete here , The master node is used for reading and writing , The slave node can only read .
Be careful : It is impossible to achieve absolute strong consistency in the distributed domain After all, there are network reasons
Redis The role of master-slave replication :
- Realization Redis colony
- Data backup
- Read / write separation
Master-slave replication requires attention : The master node will synchronize the data to the slave node in incremental or full form to ensure the consistency of the data , The efficiency comparison of traditional one master multi synchronization It is recommended to use tree form .
Master slave replication principle process :
1. You need to start from redis The server is configured in slaveof perform Lord redis service ip Address and port number
192.168.1.100:6379 ( Main services ) And password ;
2. from Redis Server and master Redis Server setup Socket A long connection ;
3. The data is synchronized to the slave in full and incremental form Redis The server
Total quantity : from Redis When it was first started ( Binary execution dump file ) rdb
The incremental : Lord Redis Every time there's a new one set When you ask aof Log files
There are still some defects in master-slave replication ?
If the primary node goes down , May lead to the whole Redis The service cannot realize write operation, which requires us to manually modify the new master operation .
边栏推荐
- How bacnet/ip gateway collects data of building centralized control system
- ABAP 技能树
- LeetCode+ 66 - 70 高精度、二分专题
- 异或的应用。(提取出数字中最右侧的1,面试中经常用的到)
- Kubelet garbage collection (exiting containers and unused images) source code analysis
- ES6 use of return in arrow function
- 卸载重装最新版mysql数据库亲测有效
- 面经---测试工程师web端自动化---大厂面试题
- golang gin框架进行分块传输
- kubernetes删除pod的流程的源码简析
猜你喜欢

kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑

什么是EC鼓风机(ec blower fan)?

Construction and exploration of vivo database and storage platform

Application and Optimization Practice of redis in vivo push platform

Principle and practice of bytecode reference detection

Cloud native (to be updated)

Source code analysis of kubernetes' process of deleting pod

Open62541 import nodeset file directly

ACM笔记

GoLand IDE and delve debug Go programs in kubernetes cluster
随机推荐
Path alias specified in vite2.9
Modifying MySQL user name root under Linux
分析 NFT 项目的 5 个指标
goland IDE和delve调试位于kubernetes集群中的go程序
kubelet驱逐机制的源码分析
扩展Prometheus的解决方案thanos的简介和几个月使用心得
ACM notes
Pfizer's new Guankou medicine has entered the Chinese market, and the listing of relevant products of domestic pharmaceutical enterprises is just around the corner
代码提交规范
Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
实时数据库 - 笔记
Will Internet talents be scarce in the future? Which technology directions are popular?
This keyword details
golang gin框架进行分块传输
剑指offer II 091.粉刷房子
Sword finger offer|: linked list (simple)
R 语言 ggmap 可视化集群
R language ggmap
网传互联网公司加班表,排名第一的没悬念
Makefile