当前位置:网站首页>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 .
边栏推荐
- [ue5] two implementation methods of AI random roaming blueprint (role blueprint and behavior tree)
- 逆变器simulink模型——处理器在环测试(PIL)
- Save video opencv:: videowriter
- 【UE5】动画重定向:如何将幻塔人物导入进游戏玩耍
- BugkuCTF-web21(详细解题思路及步骤)
- A model can do two things: image annotation and image reading Q & A. VQA accuracy is close to human level | demo can be played
- 2837xd code generation - stateflow (1)
- TD conducts functional simulation with Modelsim
- QT信号槽总结-connect函数错误用法
- 图像识别-数据标注
猜你喜欢
2837xd 代碼生成——StateFlow(4)
BugkuCTF-web24(解题思路及步骤)
Record the interesting process of using Xray for the first time
QT QLabel样式设置
Share a blog (water blog)
渗透测试的介绍和防范
What is the relationship between realizing page watermarking and mutationobserver?
2837xd code generation module learning (3) -- IIC, ECAN, SCI, watchdog, ECAP modules
【虚幻】过场动画笔记
【虚幻】按键开门蓝图笔记
随机推荐
Personal experience & blog status
2837xd 代码生成——补充(3)
BugkuCTF-web16(备份是个好习惯)
Cmake command - Official Document
Fragmenttabhost implements the interface of housing loan calculator
[ue5] blueprint making simple mine tutorial
2837xd 代码生成——总结篇
YOLO物体识别,生成数据用到的工具
Attack and defense world web advanced area unserialize3
Eslint reports an error
MySQL default transaction isolation level and row lock
【UE5】蓝图制作简单地雷教程
What wires are suitable for wiring on bread board?
Typora installation package sharing
Read Day5 30 minutes before going to bed every day_ All key values in the map, how to obtain all value values
Junit4运行mvn test 测试套件升级方案
逆变器simulink模型——处理器在环测试(PIL)
Image recognition - data augmentation
Ue5 - AI pursuit (blueprint, behavior tree)
PI control of three-phase grid connected inverter - off grid mode