|
|
581d9d |
From 279bae7ec9a571a4d52b0d876850e27772eb0933 Mon Sep 17 00:00:00 2001
|
|
|
581d9d |
From: Jiri Stransky <jistr@redhat.com>
|
|
|
581d9d |
Date: Thu, 23 Jun 2016 12:55:06 +0200
|
|
|
581d9d |
Subject: [PATCH] RabbitMQ: Forget node before 2nd joining attempt
|
|
|
581d9d |
|
|
|
581d9d |
If a first attempt at joining an existing cluster has failed and we
|
|
|
581d9d |
resort to wiping the local RabbitMQ data, make sure we also request the
|
|
|
581d9d |
local node to be forgotten from the existing cluster before we make the
|
|
|
581d9d |
join attempt, otherwise the node will be rejected.
|
|
|
581d9d |
---
|
|
|
581d9d |
heartbeat/rabbitmq-cluster | 19 +++++++++++++++++++
|
|
|
581d9d |
1 file changed, 19 insertions(+)
|
|
|
581d9d |
|
|
|
581d9d |
diff --git a/heartbeat/rabbitmq-cluster b/heartbeat/rabbitmq-cluster
|
|
|
581d9d |
index 0724901..b9ae38e 100755
|
|
|
581d9d |
--- a/heartbeat/rabbitmq-cluster
|
|
|
581d9d |
+++ b/heartbeat/rabbitmq-cluster
|
|
|
581d9d |
@@ -279,6 +279,22 @@ rmq_join_existing()
|
|
|
581d9d |
return $OCF_SUCCESS
|
|
|
581d9d |
}
|
|
|
581d9d |
|
|
|
581d9d |
+rmq_forget_cluster_node_remotely() {
|
|
|
581d9d |
+ local running_cluster_nodes="$1"
|
|
|
581d9d |
+ local node_to_forget="$2"
|
|
|
581d9d |
+
|
|
|
581d9d |
+ ocf_log info "Forgetting $node_to_forget via nodes [ $(echo $running_cluster_nodes | tr '\n' ' ') ]."
|
|
|
581d9d |
+ for running_cluster_node in $running_cluster_nodes; do
|
|
|
581d9d |
+ rabbitmqctl -n $running_cluster_node forget_cluster_node $node_to_forget
|
|
|
581d9d |
+ if [ $? = 0 ]; then
|
|
|
581d9d |
+ ocf_log info "Succeeded forgetting $node_to_forget via $running_cluster_node."
|
|
|
581d9d |
+ return
|
|
|
581d9d |
+ else
|
|
|
581d9d |
+ ocf_log err "Failed to forget node $node_to_forget via $running_cluster_node."
|
|
|
581d9d |
+ fi
|
|
|
581d9d |
+ done
|
|
|
581d9d |
+}
|
|
|
581d9d |
+
|
|
|
581d9d |
rmq_notify() {
|
|
|
581d9d |
node_list="${OCF_RESKEY_CRM_meta_notify_stop_uname}"
|
|
|
581d9d |
mode="${OCF_RESKEY_CRM_meta_notify_type}-${OCF_RESKEY_CRM_meta_notify_operation}"
|
|
|
581d9d |
@@ -336,9 +352,12 @@ rmq_start() {
|
|
|
581d9d |
rmq_join_existing "$join_list"
|
|
|
581d9d |
if [ $? -ne 0 ]; then
|
|
|
581d9d |
ocf_log info "node failed to join, wiping data directory and trying again"
|
|
|
581d9d |
+ local local_rmq_node="$(${HA_SBIN_DIR}/crm_attribute -N $NODENAME -l forever --query --name $RMQ_CRM_ATTR_COOKIE_LAST_KNOWN -q)"
|
|
|
581d9d |
+
|
|
|
581d9d |
# if the graceful join fails, use the hammer and reset all the data.
|
|
|
581d9d |
rmq_stop
|
|
|
581d9d |
rmq_wipe_data
|
|
|
581d9d |
+ rmq_forget_cluster_node_remotely "$join_list" "$local_rmq_node"
|
|
|
581d9d |
rmq_join_existing "$join_list"
|
|
|
581d9d |
rc=$?
|
|
|
581d9d |
|