群集故障转移

问题描述:

我知道我在询问有关群集故障转移的一个非常明显的问题。

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

我在redis.io上读到,如果任何主群集节点发生故障,它将影响其他节点主节点,直到从节点负责。在我的结构中,我没有定义任何从属服务器,而仅与3个主服务器一起使用。

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.

我正在考虑修改redis-trib.rb文件,该文件将删除损坏的服务器,并将与其他2个节点一起启动群集。我对几件事感到困惑,

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)重新分片


在出现故障的服务器上线之前不可能

Could not possible until failed server goes live

2)创建群集的最小3个节点限制

2) Minimum 3 node limitation for create cluster


根据一点了解,redis-trib.rb不允许我为两个节点创建集群
代码文件中可能有一些解决方案:)

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)自动使用活动节点重新创建新结构的方法

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


从程序员的角度来看,我正在为系统自动搜索某些内容。当Redis Cluster失败某些任务时,触发一个命令的事件在内部发生。

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


  • 关闭所有其他redis群集服务器

  • 从以下位置删除节点-[port] .conf文件所有群集节点文件夹

  • 启动redis群集服务器

  • 运行 redis-trib.rb create ip:port ip:port

  • 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.

谢谢,
Sanjay Mohnani

Thanks, Sanjay Mohnani

在仅具有主节点的群集,如果节点发生故障,则数据将丢失。因此,由于无法将数据(哈希插槽)从故障节点中迁移出去,因此无法进行重新分片。

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).

redis-trib.rb脚本不会使用少于3个主节点处理集群创建,但是在redis-cluster中,一个集群可以是任意大小(至少一个节点)。

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.