Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Online migration of redis clusters

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Migration scenario steps

Deploy the new node redis instance. (note that after deployment, there is no need to create a cluster.)

For example:

Old environment:

192.168.3.5:7000 M

192.168.3.5:7001 M

192.168.3.5:7002 M

192.168.3.5:7003 S

192.168.3.5:7004 S

192.168.3.5:7005 S

New environment:

192.168.3.6:7000 M

192.168.3.6:7001 M

192.168.3.6:7002 M

192.168.3.6:7003 S

192.168.3.6:7004 S

192.168.3.6:7005 S

Add the new node redis to the old cluster. (add master node)

Redis-trib.rb add-node 192.168.3.6:7000 192.168.3.5:7000

Redis-trib.rb add-node 192.168.3.6:7001 192.168.3.5:7000

Redis-trib.rb add-node 192.168.3.6:7002 192.168.3.5:7000

Add the new node redis to the old cluster. (add slave node)

Redis-trib.rb add-node-- slave 192.168.3.6 Virgo 7003 192.168.3.6 Vol 7000

Redis-trib.rb add-node-- slave 192.168.3.6VR 7004 192.168.3.6RV 7001

Redis-trib.rb add-node-- slave 192.168.3.6Rose 7005 192.168.3.6VOL7002

Check the cluster master-slave node information

Redis-cli-p 7000-a 'password' cluster nodes

Check whether the cluster status () is ok

Redis-cli-p 7000-a 'password' cluster nodes

View redis cluster master nodes

Redis-cli-p 7000-a 'password' cluster nodes | grep master

View cluster information

. / redis-trib.rb info 192.168.3.5:7000

Cluster for migration

. / redis-trib.rb reshard 192.168.3.5:7000

Note: migrate all slot to a new cluster master node.

Input: all

Enter slot: 16384

Migrate to node_id: 614272e21df1cbbcda117f277ff7baa075b3d15e (new node migrated id)

Evenly slice the slot to the new remaining master node

. / redis-trib.rb reshard 192.168.3.5:7000

. / redis-trib.rb reshard 192.168.3.5:7001

. / redis-trib.rb reshard 192.168.3.5:7002

Check whether the node migration is normal

/ redis-trib.rb echek 192.168.3.5:7000

Delete old node information (delete slave node first, then delete master node)

Delete slave node

/ redis-trib.rb del-node 192.168.3.5:7000 3c0bb15b23407f7eb6f8c5a6a2a4c9ffb7065098

/ redis-trib.rb del-node 192.168.3.5:7001 32afb3fec4ecad4bd33573a45754616324a9311b

/ redis-trib.rb del-node 192.168.3.5:7002 5f2018a5a56f3e4cfc76df566e721ca7ace8bd83

Delete the primary node (ibid.)

Note: the old environment after del-node redis process shutdown, cluster failure!

Check cluster availability and data integrity

/ redis-trib.rb check 192.168.3.5:7000

/ redis-trib.rb info 192.168.3.5:7000

Redis-cli-p 7000-a 'password' cluster nodes

Redis-cli-p 7000-a 'password' cluster info

The test works well!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report