Skip to content

Instantly share code, notes, and snippets.

@majormoses
Created April 19, 2017 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majormoses/da89381260a814046e4003d677c110e1 to your computer and use it in GitHub Desktop.
Save majormoses/da89381260a814046e4003d677c110e1 to your computer and use it in GitHub Desktop.
Removing rmq node from cluster using reset
# validating the nodes in a cluster from a machine
babrams@ip-10-55-250-69:~$ sudo rabbitmqctl cluster_status | grep rmq | cut -d\@ -f2 | grep -Eo "ip\-[0-9]+\-[0-9]+\-[0-9]+\-[0-9]+" | sort | uniq
ip-10-55-250-69
ip-10-55-251-128
ip-10-55-252-176
# validating the same from another machine
babrams@ip-10-55-251-128:~$ sudo rabbitmqctl cluster_status | grep rmq | cut -d\@ -f2 | grep -Eo "ip\-[0-9]+\-[0-9]+\-[0-9]+\-[0-9]+" | sort | uniq
ip-10-55-250-69
ip-10-55-251-128
ip-10-55-252-176
# removing first node from cluster via stop && reset
babrams@ip-10-55-251-128:~$ sudo rabbitmqctl stop_app
Stopping rabbit application on node 'rmq-9161197e59a9ce560ac6353215c7958aeeefae2cd9370fbc3cd89054026c267a@ip-10-55-251-128' ...
babrams@ip-10-55-251-128:~$ sudo rabbitmqctl reset
Resetting node 'rmq-9161197e59a9ce560ac6353215c7958aeeefae2cd9370fbc3cd89054026c267a@ip-10-55-251-128' ...
babrams@ip-10-55-251-128:~$
# validating it no longer is in any cluster other than self
babrams@ip-10-55-251-128:~$ sudo rabbitmqctl cluster_status | grep rmq | cut -d\@ -f2 | grep -Eo "ip\-[0-9]+\-[0-9]+\-[0-9]+\-[0-9]+" | sort | uniq
ip-10-55-251-128
# validating another node can no longer see it in the cluster
babrams@ip-10-55-250-69:~$ sudo rabbitmqctl cluster_status | grep rmq | cut -d\@ -f2 | grep -Eo "ip\-[0-9]+\-[0-9]+\-[0-9]+\-[0-9]+" | sort | uniq
ip-10-55-250-69
ip-10-55-252-176
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment