当前位置:网站首页>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 .
边栏推荐
- Block transmission by golang gin framework
- Can okcc call centers work without computers?
- Reading notes - MySQL technology l act: InnoDB storage engine (version 2)
- What is EC blower fan?
- kubernetes删除pod的流程的源码简析
- Ice - resources
- 在idea中,get和set方法爆红可能是没有安装Lombok插件
- Analyze 5 indicators of NFT project
- 看似简单的光耦电路,实际使用中应该注意些什么?
- Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
猜你喜欢

Uninstall and reinstall the latest version of MySQL database. The test is valid

Block transmission by golang gin framework

Kubernetes deploys a secret pit where thanos ruler sends repeated alarms

No suspense about the No. 1 Internet company overtime table

Evolution of vivo push platform architecture

Modifying MySQL port number under Linux

8 张图 | 剖析 Eureka 的首次同步注册表

LeetCode+ 51 - 55 回溯、动态规划专题

A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages

vite2.9 中指定路径别名
随机推荐
Makefile
PLC -- 笔记
What is a consistent hash? What scenarios can it be applied to?
数字藏品市场“三大套路”
mysql57 zip文件安装
Uninstall and reinstall the latest version of MySQL database. The test is valid
Block transmission by golang gin framework
MySQL installation steps - how to create a virtual machine under Linux (1)
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
R 语言 ggmap
"Three routines" of digital collection market
es6箭头函数中return的用法
linux下修改mysql用户名root
vite2.9 中指定路径别名
BACnet/IP網關如何采集樓宇集中控制系統數據
在idea中,get和set方法爆红可能是没有安装Lombok插件
Kubelet garbage collection (exiting containers and unused images) source code analysis
kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑
Practice and exploration of vivo live broadcast application technology
linux下修改mysql端口号