当集群中的另一个节点关闭时,RabbitMQ 应用程序停止

RabbitMQ application stops when another node in cluster is shutdown

我是 RabbitMQ 的新手,在处理 RabbitMQ 集群时遇到了麻烦。

拓扑如下:

起初,一切都还好。 RabbitMQ node1 和 RabbitMQ node2 在一个集群中。 它们通过名为 autocluster 的 RabbitMQ 插件互连。

然后我通过 kubectl delete pod rabbitmq-1 删除了 pod rabbitmq-1。而且我发现 node1 中的 RabbitMQ 应用程序已停止。我不明白为什么 RabbittoMQ 会在检测到另一个节点故障时停止应用程序。它没有任何意义。这种行为是由 RabbitMQ 还是 autocluster 设计的?能赐教吗?

我的配置是这样的:

[
  {rabbit, [
    {tcp_listen_options, [
                          {backlog,       128},
                          {nodelay,       true},
                          {linger,        {true,0}},
                          {exit_on_close, false},
                          {sndbuf,        12000},
                          {recbuf,        12000}
                         ]},
    {loopback_users, [<<"guest">>]},
    {log_levels,[{autocluster, debug}, {connection, debug}]},
    {cluster_partition_handling, pause_minority},
    {vm_memory_high_watermark, {absolute, "3276MiB"}}
  ]},

  {rabbitmq_management, [
    {load_definitions, "/etc/rabbitmq/rabbitmq-definitions.json"}
  ]},

  {autocluster, [
    {dummy_param_without_comma, true},
    {autocluster_log_level, debug},
    {backend, etcd},
    {autocluster_failure, ignore},
    {cleanup_interval, 30},
    {cluster_cleanup, false},
    {cleanup_warn_only, false},
    {etcd_ttl, 30},
    {etcd_scheme, http},
    {etcd_host, "etcd.kube-system.svc.cluster.local"},
    {etcd_port, 2379}
   ]}
]

就我而言,x-ha-policy 已启用。

您将 cluster_partition_handling 设置为 pause_minority。两个节点中的一个不是多数,因此集群按配置停止。您要么必须添加一个额外的节点,要么将 cluster_partition_handling 设置为 ignore.

来自docs

In pause-minority mode RabbitMQ will automatically pause cluster nodes which determine themselves to be in a minority (i.e. fewer or equal than half the total number of nodes) after seeing other nodes go down. It therefore chooses partition tolerance over availability from the CAP theorem. This ensures that in the event of a network partition, at most the nodes in a single partition will continue to run. The minority nodes will pause as soon as a partition starts, and will start again when the partition ends.