当前位置:网站首页>Project practice, redis cluster technology learning (IX)
Project practice, redis cluster technology learning (IX)
2022-07-02 10:05:00 【User 1289394】
3) Add slave node
At the beginning of capacity expansion, we put 6385、6386 Nodes join the cluster , node 6385 Some slots and data are migrated as master nodes , However, compared with other master nodes, there is no slave node at present , Therefore, the node does not have fault switching
Ability to move .
At this time, you need to set the node 6386 As 6385 The slave node , So as to ensure the high availability of the whole cluster . Use cluster replicate{masterNodeId} The command adds the corresponding slave node to the master node , Note that in cluster mode slaveof Add slave node operation is no longer supported . As shown below :
127.0.0.1:6386>cluster replicate
1a205dd8b2819a00dd1e8b6be40a8e2abe77b756
The slave node initiates full replication to the master node , You also need to update the cluster related of the local node
state , Look at the node 6386 The status confirmation has changed to 6385 The slave node of the node
127.0.0.1:6386>cluster nodes
475528b1bcf8e74d227104a6cf1bf70f00c24aae 127.0.0.1:6386 myself,slave 1a205dd8b2
819a00dd1e8b6be40a8e2abe77b756 0 0 8 connected
1a205dd8b2819a00dd1e8b6be40a8e2abe77b756 127.0.0.1:6385 master - 0
1469779083513 9
connected 0-1365 4096 5462-6826 10923-12287
...
This completes the expansion of the entire cluster , The cluster relationship structure is shown in the figure .
10.4.3 Shrink cluster
Process description :
1) First, we need to determine whether the offline node has a responsible slot , If it is , Need to move the slot to another section
spot , Ensure the integrity of the whole cluster slot node mapping after the node is offline .
2) When the downline node is no longer responsible for the slot or is itself a slave node , You can notify other nodes in the cluster to forget the offline nodes , When all nodes forget the node, they can shut down normally .
1. Offline migration slot
Offline nodes need to migrate their own slots to other nodes , The principle is the same as that of the previous node expansion migration slot
The process is consistent . For example, let's take 6381 and 6384 Node offline , Node information is as follows :
127.0.0.1:6381> cluster nodes
40b8d09d44294d2e23c7c768efc8fcd153446746 127.0.0.1:6381 myself,master - 0 0 2
connected
12288-16383
4fa7eac4080f0b667ffeab9b87841da49b84a6e4 127.0.0.1:6384 slave
40b8d09d44294d2e2
3c7c768efc8fcd153446746 0 1469894180780 5 connected
...
6381 It's the master node , Responsible slot (12288-16383),6384 It's its slave node , Pictured 10-26 Shown . Offline 6381 You need to migrate the responsible slot to other nodes before .
Shrinkage is the opposite of expansion and migration ,6381 Becomes the source node , Other master nodes become target nodes , The source node needs to take responsibility of 4096 The slots migrate evenly to the other master nodes . I'm going to use it directly here redis-trib.rb reshard Command to complete the slot migration . Because of every execution reshard Command can only have one target node , So we need to do 3 Time reshard command , Migrate separately 1365、1365、1366 Slot .
边栏推荐
猜你喜欢

Mysql索引

Image recognition - Data Cleaning

2837xd code generation - stateflow (1)

ZK configuration center -- configuration and use of config Toolkit

三相逆变器离网控制——PR控制

Junit5 支持suite的方法

Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd

Memories of a chat

Skywalking theory and Practice

Attack and defense world web advanced area unserialize3
随机推荐
2837xd 代码生成——补充(2)
【UE5】AI随机漫游蓝图两种实现方法(角色蓝图、行为树)
Error reporting on the first day of work (incomplete awvs unloading)
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
c语言编程题
2837xd code generation - Supplement (3)
Eslint reports an error
Required request body is missing: (cross domain problem)
int与string、int与QString互转
Error reporting on the first day of work (error reporting when Nessus installs WinPcap)
Junit4 runs MVN test test suite upgrade scheme
Read 30 minutes before going to bed every day_ day4_ Files
阿里云SLS日志服务
Alibaba cloud ack introduction
Save video opencv:: videowriter
2837xd code generation module learning (4) -- idle_ task、Simulink Coder
TD conducts functional simulation with Modelsim
How does {} prevent SQL injection? What is its underlying principle?
Bookmark collection management software suspension reading and data migration between knowledge base and browser bookmarks
UE4夜间打光笔记