Skip to content

Commit

Permalink
rabbitmq: Allow automatic cluster recovery before forcing it
Browse files Browse the repository at this point in the history
When joining a node into an existing cluster, check to see if it is
already clustered before force removing it from the cluster and
re-adding.  If the clustering is already functional there's no need to
force it again.
  • Loading branch information
jeckersb committed Jul 26, 2016
1 parent 5606f36 commit 1621dbb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions heartbeat/rabbitmq-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ rmq_start_first()
return $rc
}

rmq_is_clustered()
{
$RMQ_CTL eval 'rabbit_mnesia:is_clustered().' | grep -q true
}

rmq_join_existing()
{
local join_list="$1"
Expand All @@ -249,6 +254,11 @@ rmq_join_existing()
return $OCF_ERR_GENERIC
fi

if rmq_is_clustered; then
ocf_log info "Successfully re-joined existing rabbitmq cluster automatically"
return $OCF_SUCCESS
fi

# unconditionally join the cluster
$RMQ_CTL stop_app > /dev/null 2>&1
for node in $(echo "$join_list"); do
Expand Down

0 comments on commit 1621dbb

Please sign in to comment.