当前位置:网站首页>Build a master-slave mode cluster redis
Build a master-slave mode cluster redis
2022-07-02 19:33:00 【Charmaine Xia】
Install stand alone reids Detailed tutorial :https://blog.csdn.net/CharmaineXia/article/details/125297843?spm=1001.2014.3001.5502
A master node (master) There can be multiple slave nodes (slave), A slave node can only have one master node .
Each station redis By default, they are the primary node , So only the slave is configured , Do not configure the host .
Build a master-slave cluster
All three servers are installed redis, First configure the configuration file of a slave , Then copy the configuration file to other slaves .
Method 1. The configuration file configures the slave ( permanent , Restart and take effect )
① Edit the slave configuration file
vi /home/admin/redis/redis-5.0.7/theRedisConf/redis.conf
add master Of IP Or host and port number
replicaof 192.168.xxx.xxx 6379
After configuration, restart and take effect .
Method 2. Command configuration slave ( Immediate effect , but redis The service fails when it is restarted )
① Progress client , View current library information
redis-cli -p 6379 Or enter src perform ./redis-cli -p 6379
info replication
127.0.0.1:6379> info replication
# Replication
role:master # The role is master
connected_slaves:0 # No slave
master_replid:04caec4cc89fb5a3e5515c90f91d4e4922fe6e6b
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
② Set the master node of the slave
SLAVEOF The host IP 6379
View the library information after setting
info replication
# View from the machine
127.0.0.1:6379> info replication
# Replication
role:slave # The role becomes a slave
master_host:192.168.60.83 # The host IP Address
master_port:6379 # In the host redis Port number
master_link_status:down
# View... In the host
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=192.168.60.84,port=6379,state=online,offset=14,lag=0
slave1:ip=192.168.60.85,port=6379,state=online,offset=14,lag=1
master_replid:8e296970ccfa0ebd6dff8416e1d21d8f892d0dab
After the three sets are configured :
Start in turn redis service , Start the master node first , After starting the slave node .
cd /
./usr/local/bin/redis-server /home/admin/redis/redis-5.0.7/theRedisConf/redis.conf
The principle of master-slave replication :
边栏推荐
- Idea editor removes SQL statement background color SQL statement warning no data sources are configured to run this SQL And SQL dialect is not config
- 2022.7.1-----leetcode.241
- golang:[]byte转string
- Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
- 教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
- MySQL表历史数据清理总结
- MySQL高级(进阶)SQL语句
- 线程应用实例
- Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
- Introduction of Ethernet PHY layer chip lan8720a
猜你喜欢
潇洒郎:彻底解决Markdown图片问题——无需上传图片——无需网络——转发给他人图片无缺失
Excel finds the same value in a column, deletes the row or replaces it with a blank value
Educational Codeforces Round 129 (Rated for Div. 2) 补题题解
Reading notes of "the way to clean structure" (Part 2)
Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
Advanced performance test series "24. Execute SQL script through JDBC"
线程应用实例
Quanzhi A33 uses mainline u-boot
Yolov3 trains its own data set to generate train txt
搭建哨兵模式reids、redis从节点脱离哨兵集群
随机推荐
AcWing 1137. 选择最佳线路 题解(最短路)
AcWing 181. 回转游戏 题解(搜索—IDA*搜索)
Chapter 7 - class foundation
What is the MySQL backup suffix_ MySQL backup restore
Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
Npoi export Excel2007
SIFT特征点提取「建议收藏」
SIFT feature point extraction "suggestions collection"
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
Data dimensionality reduction principal component analysis
Preprocessing and preprocessing macros
Qpropertyanimation use and toast case list in QT
zabbix5客户端安装和配置
Watchful pioneer world outlook Architecture - (how does a good game come from)
PHP非对称加密方法私钥及公钥加密解密的方法
Use cheat engine to modify money, life and stars in Kingdom rush
Refactoring: improving the design of existing code (Part 1)
AcWing 1134. Shortest circuit counting problem solution (shortest circuit)
冒泡排序数组
Compile oglpg-9th-edition source code with clion