Skip to content

Instantly share code, notes, and snippets.

@arukaen
Forked from davideicardi/rabbitmq_ubuntu.sh
Created December 14, 2017 20:29
Show Gist options
  • Save arukaen/eaff7e2bfc33d59313e2a28b9a5262c7 to your computer and use it in GitHub Desktop.
Save arukaen/eaff7e2bfc33d59313e2a28b9a5262c7 to your computer and use it in GitHub Desktop.
Install rabbitmq on ubuntu and configure the cluster
Run the following script on each machine of the cluster:
sudo add-apt-repository 'deb http://www.rabbitmq.com/debian/ testing main'"
sudo apt-get update
sudo apt-get -q -y --force-yes install rabbitmq-server=3.4.1-1
sudo invoke-rc.d rabbitmq-server stop
echo 'MYCOOKIEVALUE' | sudo tee /var/lib/rabbitmq/.erlang.cookie
sudo chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
sudo chmod 400 /var/lib/rabbitmq/.erlang.cookie
sudo invoke-rc.d rabbitmq-server start
sudo rabbitmq-plugins enable rabbitmq_management
sudo invoke-rc.d rabbitmq-server stop
sudo invoke-rc.d rabbitmq-server start
sudo rabbitmqctl add_user user1 pwd1
sudo rabbitmqctl set_user_tags user1 administrator
sudo rabbitmqctl set_permissions -p / user1 '.*' '.*' '.*'
Create the cluster, run this script on each server except the first:
sudo rabbitmqctl stop_app
sudo rabbitmqctl join_cluster rabbit@myhostname1
sudo rabbitmqctl start_app
sudo rabbitmqctl set_cluster_name my_cluster_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment