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

边栏推荐
- What is the MySQL backup suffix_ MySQL backup restore
- NPOI导出Excel2007
- Horizontal ultra vires and vertical ultra vires [easy to understand]
- AcWing 1131. 拯救大兵瑞恩 题解(最短路)
- 高级性能测试系列《24. 通过jdbc执行sql脚本》
- End to end object detection with transformers (Detr) paper reading and understanding
- 搭建哨兵模式reids、redis从节点脱离哨兵集群
- Yolov3 trains its own data set to generate train txt
- 注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
- Machine learning notes - time series prediction research: monthly sales of French champagne
猜你喜欢

Web2.0 giants have deployed VC, and tiger Dao VC may become a shortcut to Web3

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

According to the atlas of data security products and services issued by the China Academy of information technology, meichuang technology has achieved full coverage of four major sectors

AcWing 342. Road and route problem solving (shortest path, topological sorting)

注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机

AcWing 1126. 最小花费 题解(最短路—dijkstra)

Registration opportunity of autowiredannotationbeanpostprocessor in XML development mode

为什么要做企业固定资产管理系统,企业如何加强固定资产管理

Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5

In pytorch function__ call__ And forward functions
随机推荐
电脑使用哪个录制视频软件比较好
Mobile robot path planning: artificial potential field method [easy to understand]
线程应用实例
第七章-类基础
《代碼整潔之道》讀書筆記
高级性能测试系列《24. 通过jdbc执行sql脚本》
Compile oglpg-9th-edition source code with clion
450-深信服面经1
搭建主从模式集群redis
IDEA编辑器去掉sql语句背景颜色SQL语句警告No data sources are configured to run this SQL...和SQL Dialect is Not Config
Date tool class (updated from time to time)
数据降维——主成分分析
Digital scroll strip animation
AcWing 1125. Cattle travel problem solution (shortest path, diameter)
PHP asymmetric encryption method private key and public key encryption and decryption method
Getting started with typescript
以太网PHY层芯片LAN8720A简介
移动机器人路径规划:人工势场法[通俗易懂]
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
Typescript 之 快速入门