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

What is the method for redis to migrate data to redis-cluster

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the method of migrating data from redis to redis-cluster". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Whether it is a single node or a cluster, you can migrate to the cluster cluster using the following ideas

Step 1) get the persistent AOF (rdb) file of the original single instance node D. If it is a cluster, move all the solt to a machine first. 2) prepare three new nodes, An and B, and set up a cluster. Currently, the cluster is empty. 3) assign all the slots on node B ~ C to A Close the new cluster (remember: be sure to close the new cluster) 4) SCP the rdb files obtained in 1) to A 5) restart the A node, load all the data into memory, and then start the BC node 6) evenly distribute the slots on the A node to BMague C7) newly prepared A1Mague B1 C1, added to the cluster 8) verify the integrity of the data and cluster status as the slave of AMague BMague C, respectively.

Step 6 in the step may report the following error when allocating

[ERR] Calling MIGRATE ERR Syntax error, try CLIENT (LIST | KILL | GETNAME | SETNAME | PAUSE | REPLY)

Solution:

The version of the redis library installed by ruby gem cannot use the latest 4.0, otherwise a syntax error will be reported when redis-trib.rb reshard 127.0.0.1 redis-trib.rb reshard 7000 is re-shredded. 1. Uninstall the latest redis library, gem uninstall redis2, install version 3.x, gem install redis-v 3.3.5 tests 3.2.1 to 3.3.5, and fragments above 4.x report an error.

After reshard fails, if check has the following error

[WARNING] Node 192.168.0.11 The following slots are open 6380 has slots in migrating state (5461). [WARNING] The following slots are open: 5461 you can use the redis command to cancel the slots migration (5461 is the ID of slot): cluster setslot 5461 stable needs to be noted that you must log in to 192.168.0.11 stable to execute the redis setslottery subcommand.

Migration mode 2:

It works only when there is no password (single node > cluster) / usr/local/src/redis-4.0.8/src/redis-trib.rb.bak import-- from 172.31.47.95copy 6381-- copy 172.31.32.223pur6379 View the size127.0.0.1:6379 > dbsize (integer) 466127.0.0.1copy 6379 of each node > dbsize (integer) 478127.0.0.1 copy 6379 > dbsize (integer) 441 All key have been automatically assigned to different slot. "what is the method of redis migrating data to redis-cluster?" that's it. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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