Redis cluster startup problem

1. Problem description

[ERR] Node 192.168.43.175:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

2. Problem analysis

  This is due to the redisabnormal shutdown of the cluster when it is shut down, also known as downtime. redisThe server didn't have time to save the relevant data and the information was lost. So you need to delete the local backup file and restart the server.

3. Problem solving

  Because you want to delete the data, you can simply rediskill the process here . First ps -ef | grep redisget redisthe basic information of the process through the command . Then directly move the process kill, note: here killis the clusterprocess. Run the ps -ef | grep rediscommand again to verify that the process has been forcibly terminated. According to this method, the other redisservers in the cluster are suspended in turn.

Insert picture description here

  Then enter the redisdirectory where the server's local files are located, the author's directory is /var/redis. We chose to enter a server directory, for example 7001, we found that there are nodes.confother files, we need to delete these files. Run rm -rf *, check the folder again and find that our files have been deleted. Follow this method to delete all the files in the cluster one by one.

Insert picture description here

  Then start the servers one by one. Running ./redis_7001 start. There was a /var/run/redis_7001.pid exists, process is already running or crashedproblem. It needs to be deleted. Running rm -rf /var/run/redis_7001.pid. Start the server again. The server can start normally.

Insert picture description here

  Finally, run the cluster start command again /usr/local/bin/redis-trib.rb create --replicas 1 192.168.43.175:7001 192.168.43.175:7002 192.168.43.176:7003 192.168.43.176:7004 192.168.43.177:7005 192.168.43.177:7006. You can successfully start the entire cluster.

Insert picture description here

4. Summary

  If it is not abnormal or other special circumstances, you must shut down the rediscluster normally , so restarting it will avoid a lot of trouble. It might be a bit wordy. But if there are bloggers who can write it step by step before, I won't spend a long time debugging, not to mention, all tears. Continue to move bricks.

Like it and go! Welcome to leave a message!

Published 22 original articles · praised 4 · 220,000 views

Guess you like

Origin blog.csdn.net/qq_32510597/article/details/105464624