当前位置:网站首页>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 :

边栏推荐
- 虚拟机初始化脚本, 虚拟机相互免秘钥
- mybatiesHelperPro工具必须的可以生成到对应项目文件夹下
- 搭建哨兵模式reids、redis从节点脱离哨兵集群
- End-to-End Object Detection with Transformers(DETR)论文阅读与理解
- MySQL高级(进阶)SQL语句
- 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
- Compile oglpg-9th-edition source code with clion
- Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3
- Yunna | why use the fixed asset management system and how to enable it
- Educational Codeforces Round 129 (Rated for Div. 2) 补题题解
猜你喜欢

PHP-Parser羽毛球预约小程序开发require线上系统

程序猿入门攻略(十二)——数据的存储

搭建哨兵模式reids、redis从节点脱离哨兵集群

IDEA编辑器去掉sql语句背景颜色SQL语句警告No data sources are configured to run this SQL...和SQL Dialect is Not Config

mysql函数

AcWing 342. 道路与航线 题解 (最短路、拓扑排序)

数据降维——主成分分析

Advanced performance test series "24. Execute SQL script through JDBC"

Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode

Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5
随机推荐
函数高阶-柯里化实现
数字滚动带动画
AcWing 1131. Saving Private Ryan (the shortest way)
AcWing 1125. 牛的旅行 题解(最短路、直径)
452-strcpy、strcat、strcmp、strstr、strchr的实现
股票证券公司排名,有安全保障吗
线程应用实例
AcWing 1129. 热浪 题解(最短路—spfa)
搭建哨兵模式reids、redis从节点脱离哨兵集群
AcWing 383. Sightseeing problem solution (shortest circuit)
Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5
[error record] problems related to the installation of the shuttle environment (follow-up error handling after executing the shuttle doctor command)
AcWing 1137. 选择最佳线路 题解(最短路)
metric_ Logger urination
Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode
SIFT特征点提取「建议收藏」
Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5
Educational Codeforces Round 129 (Rated for Div. 2) 补题题解
Date tool class (updated from time to time)
AcWing 343. Sorting problem solution (Floyd property realizes transitive closure)