如何在不停机的情况下将单令牌群集迁移到新的vnodes群集? [英] How to migrate single-token cluster to a new vnodes cluster without downtime?

查看:80
本文介绍了如何在不停机的情况下将单令牌群集迁移到新的vnodes群集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有Cassandra集群,每个节点具有单个令牌,总共22个节点,每个节点的平均负载为500Gb。它具有用于主键空间和SimpleSnitch的SimpleStrategy。

We have Cassandra cluster with single token per node, total 22 nodes, average load per node is 500Gb. It has SimpleStrategy for the main keyspace and SimpleSnitch.

我们需要将所有数据迁移到新数据中心,并在不停机的情况下关闭旧数据中心。新集群有28个节点。我想在上面放上vnode。

We need to migrate all data to the new datacenter and shutdown the old one without a downtime. New cluster has 28 nodes. I want to have vnodes on it.

我正在考虑以下过程:


  1. 将旧群集迁移到vnode

  2. 使用vnodes设置新群集

  3. 将新群集中的节点添加到旧群集中,然后等待直到平衡所有内容为止

  4. 将客户端切换到新集群

  5. 从旧集群中逐一停用节点

  1. Migrate the old cluster to vnodes
  2. Setup the new cluster with vnodes
  3. Add nodes from the new cluster to the old one and wait until it balances everything
  4. Switch clients to the new cluster
  5. Decommission nodes from the old cluster one by one

但是有很多技术细节。首先,是否应该在vnodes迁移后重新整理旧集群?然后,切换到NetworkTopologyStrategy和GossipingPropertyFileSnitch的最佳方法是什么?我想切换到NetworkTopologyStrategy,因为新群集具有2个具有独立电源/网络交换机的不同机架。

But there are a lot of technical details. First of all, should I shuffle the old cluster after vnodes migration? Then, what is the best way to switch to NetworkTopologyStrategy and to GossipingPropertyFileSnitch? I want to switch to NetworkTopologyStrategy because new cluster has 2 different racks with separate power/network switches.

推荐答案


在vnodes迁移后,我应该改组旧群集吗?

should I shuffle the old cluster after vnodes migration?

您不需要。如果您从每个节点一个令牌到256(默认值),则每个节点会将其范围划分为256个相等大小的相邻范围。这不会影响数据的存放位置。但这意味着当您在新DC中引导到新节点时,它将在整个过程中保持平衡。

You don't need to. If you go from one token per node to 256 (the default), each node will split its range into 256 adjacent, equally sized ranges. This doesn't affect where data lives. But it means that when you bootstrap in a new node in the new DC it will remain balanced throughout the process.


什么是最好的方法切换到NetworkTopologyStrategy和GossipingPropertyFileSnitch?

what is the best way to switch to NetworkTopologyStrategy and to GossipingPropertyFileSnitch?

困难在于切换复制策略通常不安全,因为需要移动数据在集群周围。如果您告诉节点节点在不同的机架中,则NetworkTopologyStrategy(NTS)会将数据放置在不同的节点上。因此,您应该在添加新节点之前移至NTS。

The difficulty is that switching replication strategy is in general not safe since data would need to be moved around the cluster. NetworkToplogyStrategy (NTS) will place data on different nodes if you tell it nodes are in different racks. For this reason, you should move to NTS before adding the new nodes.

在将旧群集升级到vnode之后,这是一种执行此操作的方法(您的步骤以上1):

Here is a method to do this, after you have upgraded the old cluster to vnodes (your step 1 above):

1a。在属性文件中将所有现有节点列出为DC0。列出新节点在DC1中及其正确的机架中。

1a. List all existing nodes as being in DC0 in the properties file. List the new nodes as being in DC1 and their correct racks.

1b。使用选项DC0:3(或任何当前的复制因子)和DC1:0将复制策略更改为NTS。

1b. Change the replication strategy to NTS with options DC0:3 (or whatever your current replication factor is) and DC1:0.

然后添加新节点,请按照以下过程进行操作此处: http:// www .datastax.com / docs / 1.2 / operations / add_replace_nodes#adding-a-data-center-to-a-cluster 。请记住将令牌数设置为256,因为默认情况下它将为1。

Then to add the new nodes, follow the process here: http://www.datastax.com/docs/1.2/operations/add_replace_nodes#adding-a-data-center-to-a-cluster. Remember to set the number of tokens to 256 since it will be 1 by default.

在步骤5中,应将DC0的复制因子设置为0,即更改复制DC0:0,DC1:3的选项。现在这些节点没有被使用,因此退役将不会传输任何数据,但是您仍然应该这样做而不是关闭电源,以便将它们从环中删除。

In step 5, you should set the replication factor for DC0 to be 0 i.e. change replication options to DC0:0, DC1:3. Now those nodes aren't being used so decommission won't stream any data but you should still do it rather than powering them off so they are removed from the ring.

注意一个风险是,对旧节点的一致性级别较低的写入可能会丢失。为了防止这种情况,您可以在切换到新的DC之后写在CL.LOCAL_QUORUM上。还有一个小窗口,在该窗口中可能会丢失写入(在第3步和第4步之间)。如果重要的话,可以在停用旧节点之前进行修复,以确保没有损失或保持较高的一致性。

Note one risk is that writes made at a low consistency level to the old nodes could get lost. To guard against this, you could write at CL.LOCAL_QUORUM after you switch to the new DC. There is still a small window where writes could get lost (between steps 3 and 4). If it is important, you can run repair before decommissioning the old nodes to guarantee no losses or write at a high consistency level.

这篇关于如何在不停机的情况下将单令牌群集迁移到新的vnodes群集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆