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

The solution to the failure to restart the redis Cluster

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

Share

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

Redis uses cluster deployment, and if there is a power outage or server restart, sometimes it will not start when it starts again. You need to use the fix command of trib to fix it. If the repair still does not work, you can erase the node data and then re-build the cluster, as long as the backup is done.

1. Use redis-cli to connect to one of the redis

Redis-cli-c-h xxx-p 7001

Enter cluster info to view the status of the current cluster

two。 Cluster status that can be detected using trib's check

Redis-trib.rb check xxx:7001 [ERR] Not all 16384 slots are covered by nodes.

3. If the above error occurs, you can try to fix it using the fix command

Redis-trib.rb fix xxx:7001

After the repair is complete, check the status using the check command of trib

4. If you can't fix it through fix,

The redis process before pkill redis stops

Then delete the aof,rdb,nodes node file, which needs to be backed up before deletion

5. Then start each redis node

Redis-server / usr/local/src/redis-3.2.4/redis_cluster/7000/redis.confredis-server / usr/local/src/redis-3.2.4/redis_cluster/7001/redis.confredis-server / usr/local/src/redis-3.2.4/redis_cluster/7002/redis.confredis-server / usr/local/src/redis-3.2.4/redis_cluster/7003/redis.confredis-server / usr/local/src/redis-3.2. 4/redis_cluster/7004/redis.confredis-server / usr/local/src/redis-3.2.4/redis_cluster/7005/redis.conf

6. Create a redis cluster

Redis-trib.rb create-replicas 1 xxx:7000 xxx:7001 xxx:7002 xxx:7003 xxx:7004 xxx:7005

7. After the cluster is created, connect to redis again to check the cluster status. As shown in the figure, you can see that the redis service of 3 masters and 3 slaves has been started.

Redis-cli-c-h xxx-p 7000cluster infocluster nodes

These are the details of how redis clusters solve problems that cannot be restarted. Please pay attention to other related articles for more information.

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