首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何缩小CrateDB集群的规模?

如何缩小CrateDB集群的规模?
EN

Stack Overflow用户
提问于 2016-12-08 15:25:53
回答 1查看 304关注 0票数 2

为了进行测试,我想将我的3节点集群缩小到2节点,然后对我的5节点集群执行同样的操作。

然而,在遵循缩小集群的最佳实践之后:

  1. 备份所有桌子
  2. 对于所有表:如果它之前小于2,则为alter table xyz set (number_of_replicas=2)
  3. SET GLOBAL PERSISTENT discovery.zen.minimum_master_nodes = <half of the cluster + 1>; 3 a.如果数据检查应该始终是绿色的,则将min_availability设置为“full”:https://crate.io/docs/reference/configuration.html#graceful-stop
  4. 在一个节点上启动优美的停止
  5. 等待数据检查变成绿色
  6. 从3开始重复。
  7. 完成后,将节点配置保持在crate.ymlgateway.recover_after_nodes: n discovery.zen.minimum_master_nodes:[![enter image description here][1]][1] (n/2) +1 gateway.expected_nodes: n中。

我的集群再也没有返回到“绿色”,我也有一个关键节点检查失败。

这里出了什么问题?

crate.yml:

代码语言:javascript
复制
  ... 
  ################################## Discovery ##################################

  # Discovery infrastructure ensures nodes can be found within a cluster
  # and master node is elected. Multicast discovery is the default.

  # Set to ensure a node sees M other master eligible nodes to be considered
  # operational within the cluster. Its recommended to set it to a higher value
  # than 1 when running more than 2 nodes in the cluster.
  #
  # We highly recommend to set the minimum master nodes as follows:
  #   minimum_master_nodes: (N / 2) + 1 where N is the cluster size
  # That will ensure a full recovery of the cluster state.
  #
  discovery.zen.minimum_master_nodes: 2

  # Set the time to wait for ping responses from other nodes when discovering.
  # Set this option to a higher value on a slow or congested network
  # to minimize discovery failures:
  #
  # discovery.zen.ping.timeout: 3s
  #

  # Time a node is waiting for responses from other nodes to a published
  # cluster state.
  #
  # discovery.zen.publish_timeout: 30s

  # Unicast discovery allows to explicitly control which nodes will be used
  # to discover the cluster. It can be used when multicast is not present,
  # or to restrict the cluster communication-wise.
  # For example, Amazon Web Services doesn't support multicast discovery.
  # Therefore, you need to specify the instances you want to connect to a
  # cluster as described in the following steps:
  #
  # 1. Disable multicast discovery (enabled by default):
  #
  discovery.zen.ping.multicast.enabled: false
  #
  # 2. Configure an initial list of master nodes in the cluster
  #    to perform discovery when new nodes (master or data) are started:
  #
  # If you want to debug the discovery process, you can set a logger in
  # 'config/logging.yml' to help you doing so.
  #
  ################################### Gateway ###################################

  # The gateway persists cluster meta data on disk every time the meta data
  # changes. This data is stored persistently across full cluster restarts
  # and recovered after nodes are started again.

  # Defines the number of nodes that need to be started before any cluster
  # state recovery will start.
  #
  gateway.recover_after_nodes: 3

  # Defines the time to wait before starting the recovery once the number
  # of nodes defined in gateway.recover_after_nodes are started.
  #
  #gateway.recover_after_time: 5m

  # Defines how many nodes should be waited for until the cluster state is
  # recovered immediately. The value should be equal to the number of nodes
  # in the cluster.
  #
  gateway.expected_nodes: 3
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-08 15:25:53

所以有两件事很重要:

  • 副本的数量实质上是典型设置中可以松散的节点数(推荐使用2个副本,这样就可以缩小和松散进程中的节点,但仍然可以)
  • 建议在集群>2个节点时使用此过程;)

CrateDB将以没有副本和主节点共享的方式在集群中自动分发碎片。如果这是不可能的(如果您有2个节点和1个主节点以及2个副本,则数据检查将永远不会返回到“green”。因此,在您的示例中,将副本的数量设置为1,以便将集群恢复为绿色(alter table mytable set (number_of_replicas = 1))。

关键节点检查是由于集群还没有收到更新的crate.yml :您的文件中还有一个3节点集群的配置,因此产生了消息。由于CrateDB只在启动时加载expected_nodes (它是不是运行时设置),因此需要重新启动整个集群才能完成缩小。它可以通过滚动重新启动来完成,但是一定要正确地设置SET GLOBAL PERSISTENT discovery.zen.minimum_master_nodes = <half of the cluster + 1>;,否则协商一致将无法工作.

此外,还建议一个一个地缩小规模,以避免重新平衡和意外地丢失数据,从而使集群超载。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41042959

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档