如果在 Cassandra 中更换了一个节点,数据会自动复制到那个节点吗?
If a node is replaced in Cassandra, will data automatically replicate to that node?
我是 运行 一个复制因子为 3 的 3 节点 Cassandra 集群。我最近不得不更换其中一个节点。其他两个节点中存在的数据会自动复制到新节点还是我必须以某种方式手动执行?
默认情况下 2.x,是的。如果 auto_bootstrap 配置选项不在 cassandra.yaml 文件中,或者它被设置为 True,那么它将在它在线时立即流式传输它现在负责的所有数据。如果 auto_bootstrap 设置为 False,那么它将 不会 直到你调用 nodetool rebuild 来这样做。
然而,正如 documentation 所指出的,如果您允许它自动流式传输数据,还有最后一步:
After all new nodes are running, run nodetool cleanup on each of the previously existing nodes to remove the keys that no longer belong to those nodes. Wait for cleanup to complete on one node before running nodetool cleanup on the next node.
Cleanup can be safely postponed for low-usage hours.
如果您不运行清理,那么所有旧的数据位(移动到新节点的数据)将保留在旧的 3 个节点上。
编辑:此外,post 中未提及,请确保您在种子列表中设置了种子。否则它当然不知道去哪里找数据。
我是 运行 一个复制因子为 3 的 3 节点 Cassandra 集群。我最近不得不更换其中一个节点。其他两个节点中存在的数据会自动复制到新节点还是我必须以某种方式手动执行?
默认情况下 2.x,是的。如果 auto_bootstrap 配置选项不在 cassandra.yaml 文件中,或者它被设置为 True,那么它将在它在线时立即流式传输它现在负责的所有数据。如果 auto_bootstrap 设置为 False,那么它将 不会 直到你调用 nodetool rebuild 来这样做。
然而,正如 documentation 所指出的,如果您允许它自动流式传输数据,还有最后一步:
After all new nodes are running, run nodetool cleanup on each of the previously existing nodes to remove the keys that no longer belong to those nodes. Wait for cleanup to complete on one node before running nodetool cleanup on the next node.
Cleanup can be safely postponed for low-usage hours.
如果您不运行清理,那么所有旧的数据位(移动到新节点的数据)将保留在旧的 3 个节点上。
编辑:此外,post 中未提及,请确保您在种子列表中设置了种子。否则它当然不知道去哪里找数据。