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

Redis Cluster online migration

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Due to the lack of physical hardware performance of the previous redis cluster. Decided to upgrade to a better server.

Considering that redis is the core production database, it is decided to migrate online, the migration process, and uninterrupted service.

Here are the steps to complete the migration of the test environment:

1. Original environment (test environment, no slave created)

10.21.14.251:700010.21.14.251:700110.21.14.251:7002

two。 On the new host, start three redis instances

10.21.10.120:700010.21.10.120:700110.21.10.120:7002

3. Add all three redis to the cluster. Command format redis-trib.rb add-node

< 原集群节点名>

. / redis-trib.rb add-node 10.21.10.120:7000 10.21.14.251:7000./redis-trib.rb add-node 10.21.10.120:7001 10.21.14.251:7000./redis-trib.rb add-node 10.21.10.120:7002 10.21.14.251:7000

4. After confirming that the addition is successful, start reshard slot

. / redis-trib.rb reshard 10.21.10.120:7000

5. Encountered a problem, due to network timeout and other reasons, resulting in resharding outage. Then there is a situation of slot on both sides, which needs to be repaired by fix.

[redis@ip-10-21-14-251 redis] $. / redis-trib.rb reshard 10.21.10.120 slots:894 7000 > Performing Cluster Check (using node 10.21.10.120V 7000) M: 4422ab38377fa8828e0f7884570b3b482a66496b 10.21.10.120V 7000 slots:5026-5460 (435 slots) master 0 additional replica (s) M: 5b38e63a1091baa3a871a52275489a2aa1d28bfb 10.21.10.120 5b38e63a1091baa3a871a52275489a2aa1d28bfb 7002 slots:894-3397 (2504 slots) master 0 additional replica (s) M: bb1572074d41254e5b4d5aae5c52e54f5129d6d5 10.21.14.251 Slots:3398-4999 additional replica 5461-15922 (12064 slots) master 0 additional replica (s) M: 396a7fbd2ec61752f9e848a1d8cc7b405aef0356 10.21.14.251 Vega 7000 slots: (0 slots) master 0 additional replica (s) M: 9f215e7e4b511f3d2bbf5d734731899b71a62a3b 10.21.10.120 master 7001 slots:0-893 Magna 5000-5025 slots (946 slots) master 0 additional replica (s) M: 0c9b383f65ae4fefc5e02617fb76a845d7510a53 10.21.14.251 master 7002 slots:15949-16383 (435 slots) master 0 additional replica (s) [OK] All nodes agree about slots Configuration. > > Check for open slots... [WARNING] Node 10.21.10.120 WARNING 7002 has slots in importing state (3398). [WARNING] Node 10.21.14.251 WARNING 7001 has slots in migrating state (3398). [WARNING] The following slots are open: 3398 > Check slots coverage... [OK] All 16384 slots covered.*** Please fix your cluster problems before resharding Performing Cluster Check (using node 10.21.10.1207000) M: 4422ab38377fa8828e0f7884570b3b482a66496b 10.21.10.1207000 slots : 3399-4999 5b38e63a1091baa3a871a52275489a2aa1d28bfb 5026-7332 (3908 slots) master 0 additional replica (s) M: 5b38e63a1091baa3a871a52275489a2aa1d28bfb 10.21.10.120 additional replica 7002 slots:894-3398 Magazine 7333-15332 master 0 additional replica (s) M: bb1572074d41254e5b4d5aae5c52e54f5129d6d5 10.21.14.251additional replica 7001 slots: (0 slots) master 0 additional replica (s) M: 396a7fbd2ec61752f9e848a1d8cc7b405aef0356 10.21.14.2517000 slots: (0 slots) master 0 additional replica (s) M: 9f215e7e4b511f3d2bbf5d734731899b71a62a3b 10.21.10.12017001 Slots:0-893 All 5000-5025 15333-15948 (1536 slots) master 0 additional replica (s) [OK] All nodes agree about slots configuration. > > Check for open slots... > > Check slots coverage... [OK] All 16384 slots covered.

Status check

[redis@ip-10-21-14-251 redis] $. / redis-cli-p 7000 cluster nodesbb1572074d41254e5b4d5aae5c52e54f5129d6d5 10.21.14.251 cluster nodesbb1572074d41254e5b4d5aae5c52e54f5129d6d5 7001 master-01509611900094 6 connected9f215e7e4b511f3d2bbf5d734731899b71a62a3b 10.21.10.120Vera 7001 master-01509611902100 14 connected 0-8935000-5025 15333-159485b38e63a1091baa3a871a52275489a2aa1d28bfb 10.21.10.redis-cli 1207002 master-01509611901098 13 connected 894-33987333-15332 15949-16383396a7fbd2ec61752f9e848a1d8cc7b405aef0356 10.21.14.2517000 myself,master-001 connected4422ab38377fa8828e0f7884570b3b482a66496b 10.21.10.12017000 master-01509611899093 12 connected 3399-4999-73332

According to the above steps, delete the remaining nodes.

After testing, the application is not affected in the process of migration. But IP that applies connection pooling needs to find an opportunity to add 10.21.10.120.

For more links, please refer to

Redis Cluster cluster deployment build Redis Cluster add / remove full toss steps

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