Showing posts with label rabbitmq. Show all posts
Showing posts with label rabbitmq. Show all posts

Thursday, July 12, 2012

Clustering RabbitMQ on CentOS 6

#Assuming you got to instances of RabbitMQ installed on two separate computers in the same LAN segment, run the following command on both nodes (A and B):

rabbitmqctl status

# verify that both RabbitMQ nodes run EXACTLY the same Erlang version
# if they do not - upgrade Erlang on one of them to match the second Erlang version
# at the beginning of its layout the command displays RabbitMQ node name, e.g. rabbit@my-server-A - note this node name for the later use

# Check that both machines A and B can talk to each other (no firewall issues etc)

telnet localhost 4369


# Let's work on server A configuring RabbitMQ there to be clustered with server B.
# all the work is done on server A only, nothing should be done on server B

# stop rabbitmq service on server A

service rabbitmq-server stop



# add alias for B an A:
vi /etc/hosts

# add to /etc/hosts the alias of server B like it is displayed in the "rabbitmqctl status" output after "@" symbol, e.g. "10.10.10.10   my-server-B"
# use internal IP for server B alias if you got such, so the connection between serves A and B will go over internal switch

# copy Erlang cookie from the server B to the server  A:
scp root@my-server-B:/var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie

# give the cookie file the correct ownership (comes with 'root' after copying)
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie

# start rabbitmq service
service rabbitmq-server start

#stop and reset the app
rabbitmqctl stop_app

rabbitmqctl reset

# cluster the current node (on server A) to the node on server B as a disk node
#(if you prefer to cluster node A to B as RAM node run       rabbitmqctl cluster rabbit@my-server-B)

rabbitmqctl cluster rabbit@my-server-B rabbit@my-server-A

# you should see the success message here

# start the app and enjoy
rabbitmqctl start_app

#verify that two nodes are indeed clustered: use management plugin
# go to server A, HTTP on port 55672
# you should see "node" column in the Queues view, filled in with 'my-server-B' node name










Sunday, March 25, 2012

Installing RabbitMQ on CentOS, Fedora and RHEL

# Login as root. Note "-" in su command, it is important to get proper shell definitions including the PATH
su -
....enter password


#verify OS version
cat /etc/*release*

# Download and enable EPEL
# for CentOS 5:

# rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# for CentOS 6:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm 


#Get & install Erlang
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter
/erlang/epel-erlang.repo

yum install erlang

# Get RabbitMQ signing key
rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc

# check for the latest version at RabbitMQ web site: http://www.rabbitmq.com/install-rpm.html
rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.4/rabbitmq-server-2.8.4-1.noarch.rpm

yum install rabbitmq-server-2.8.4-1.noarch.rpm

# if this command did not work take a look what you got in online repositories:
# http://repos.fedorapeople.org/repos/peter/erlang/
# probably your RPM does not exists there
# in this case you can try using older RPM
# if you decided to do that, do teh following:
vi /etc/yum.repos.d/epel-erlang.repo

#comment line
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-$releasever/$basearch/

# and replace it with
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-5/$basearch/


# next, comment line
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-$releasever/SRPMS

# and replace it with
baseurl=http://repos.fedorapeople.org/repos/peter/erlang/epel-5/SRPMS

# exit vi and try again running
# yum install rabbitmq-server-2.8.4-1.noarch.rpm

# Add RabbitMQ to list of services to be started on reboot
chkconfig rabbitmq-server on

# Add RabbitMQ management plugin:
/usr/sbin/rabbitmq-plugins enable rabbitmq_management sudo

# start RabbitMQ server

service rabbitmq-server start


# point your browser to  http://[your-rabbitmq-server]:55672
# enter user name / pwd: the defaults are guest / guest