Nodes fail to form a cluster, so classic mirrored queue leader election cannot proceed #3837
-
We recently encounterd an issue where, the rabbitmq cluster fails to continue operations after a sequence of fail over events in the rabbitmq cluster servers. Below is the sequence of steps to reproduce the same:
Expectation at this point is since the ha-promote-on-failure flag is default always, server1 is expected to become the leader of the queue and since But, the server1 fails to come up and continously terminates with below logs in the server.
And, when looked into the disk snapshot of the queue, idx files are missing in the disk. Only metadata files are available at this point. The rabbitmq cluster remains at this stage and never succeeds to boot up successfully from this point. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Since it appears it is relatively easy for you to reproduce this issue, could you please re-run your test using the current version of RabbitMQ? https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.9.11 Also, please note that two-node RabbitMQ clusters are not supported. Finally, it would be extremely helpful if you could provide a script we can run to set up a k8s environment in exactly the same manner as you have. It takes a significant amount of time that we frankly don't have to try to reproduce an environment based on a description of how you have set yours up. |
Beta Was this translation helpful? Give feedback.
-
I will convert this issue to a GitHub discussion. Currently GitHub will automatically close and lock the issue even though your question will be transferred and responded to elsewhere. This is to let you know that we do not intend to ignore this but this is how the current GitHub conversion mechanism makes it seem for the users :( |
Beta Was this translation helpful? Give feedback.
-
This behavior has nothing to do with queues. Your nodes fail to form a cluster after a restart. See Restarting Cluster Nodes to learn what the assumptions are. The key one is: all previously existing cluster nodes must come online within a 5 minute window of time by default. This is evident from the logs where the node times out after 10 attempts to contact its peer:
On Kubernetes, a poorly picked readiness probe will lead to a deadlock because it would expect one node to report as fully booted which it won't, because it waits for its peers to come online, which never will because Kubernetes can be instructed to deploy pods one by one. This can be solved by either forming a cluster in parallel — our own Kubernetes Operator does that with modern RabbitMQ versions — or using a very basic health check as readiness probe as the docs demonstrate. This interplay between readiness probes and RabbitMQ cluster nodes assumptions upon restart has been discussed so many times on Until all of that happens and nodes re-form the cluster, none of your classic mirrored queue settings would have any effect. I should mention that
Not that quorum queues would magically work around the problem with a readiness probe or another deployment feature prevents |
Beta Was this translation helpful? Give feedback.
-
Hi @michaelklishin, @lukebakken, We tried below additional tests inline with your previous responses.
We also tried the same sequence on a queue with "ha-promote-on-failure" set to "when synced", "ha-sync-mode" set to "automatic" and ha set to "all". Results were the same i.e cluster fails to recover back. On the request for a script to deploy a k8s cluster for the same, since we have used statefulset and pods just to run the rabbitmq servers and none of the k8s behavior has impacted the above test flow, similar thing can be done even on a plain rpm mode of deployment. This issue should not be k8s specific. |
Beta Was this translation helpful? Give feedback.
You've demonstrated that the cluster can be restored when nodes come up within 5 minutes, as is documented.
We don't know anything about your liveness and readiness checks. All I can say is that it is imperative all nodes are up and running well within 5 minutes so that cluster re-formation does not time out.
#3837 (comment)
https://blog.rabbitmq.com/posts/2020/08/deploying-rabbitmq-to-kubernetes-whats-involved/
https://rabbitmq.com/clustering.html#restarting-readiness-probes
We strongly suggest using our official k8s operator -
https://www.rabbitmq.com/kubernetes/operator/operator-overview.html