当前位置:网站首页>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 .
边栏推荐
猜你喜欢

In idea, the get and set methods may be popular because the Lombok plug-in is not installed

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

推荐系统系列精讲(第五讲): 排序模型的调优实践

Design and practice of vivo sensitive word matching system

Cloud native (to be updated)

Alibaba cloud server creates snapshots and rolls back disks

What should I do if the version is incompatible with the jar package conflict?

The practice of traffic and data isolation in vivo Reviews

es6箭头函数中return的用法

Construction and exploration of vivo database and storage platform
随机推荐
R language ggmap visual cluster
A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages
Modifying MySQL port number under Linux
小小一款代码编辑器竟然也可以有程序运行之功能——Sublime Text3运行各种语言程序的总结
大型项目中的Commit Message规范化控制实现
Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
8 张图 | 剖析 Eureka 的首次同步注册表
Using interceptor and cache to complete interface anti brushing operation
数字藏品市场“三大套路”
Comprehensive analysis of real enterprise software testing process
Top 25 most popular articles on vivo Internet technology in 2021
Ice, protobuf, thrift -- Notes
Optimization steps of SQL statements (II) -- MySQL statement optimization
Can okcc call centers work without computers?
代码提交规范
linux下修改mysql端口号
Is it safe to open a stock trading account on your mobile phone?
NDK 交叉编译
R language hitters data analysis
flutter 实现摇一摇功能