Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
588 views
in Technique[技术] by (71.8m points)

redis - Cluster Failover

I know I'm asking something very obvious about cluster failover.

I read on redis.io that, if any master cluster node fails it will affect to other master nodes until slave come to take in charge. In my structure, I'm not defining any slave and just working with 3 masters.

I'm thinking to modify the redis-trib.rb file, which will remove the defected server and will start the cluster with other 2 nodes. I'm confused about a couple of things,

1) Resharding

Could not possible until failed server goes live

2) Minimum 3 node limitation for create cluster

As per bit understanding, redis-trib.rb not allowing me to create cluster for two nodes There might be some solution in code file :)

3) Automatic Way to Re-Create new structure with live nodes

As programmer point of view, I'm searching something automatic for my system. Something that trigger one command when Redis Cluster fails some tasks happens internally. like

  • Shutdown all other redis cluster servers
  • Remove nodes-[port].conf files from all cluster nodes folder
  • Start redis cluster servers
  • Run "redis-trib.rb create ip:port ip:port"

I'm just trying to minimize administration work :). Otherwise I need to implement some other algorithm "Data Consistency" here.

If any of you guys have any solution or idea, kindly share.

Thanks, Sanjay Mohnani

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In a cluster with only master nodes, if a node fails, data is lost. Therefore no resharding is possible, since it is not possible to migrate the data (hash slots) out of the failed node.

To keep the cluster working when a master fails, you need slave nodes (one per master). This way, when a master fails, its slave fails over (becomes the new master with the same copy of the data).

The redis-trib.rb script does not handle cluster creation with less than 3 masters, however in redis-cluster a cluster can be of any size (at least one node).

Therefore adding slave nodes can be considered an automatic solution to your problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...