Configuring RabbitMQ Cluster on Cloud

Follow following steps to configure RabbitMQ server Cluster on Rackspace Cetos5.5–

1. Install gcc on the centos by running following commands on the command prompt
[root@RabbitMQ1 /root/] yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
2. Download Erlang source code by using following command
[root@RabbitMQ1 /root/] wget http://www.erlang.org/download/otp_src_R14B.tar.gz
3. Extract downloaded file using following command
[root@RabbitMQ1 /root/] tar -zxvf otp_src_R14B.tar.gz
4. Configure Erlang by running following command
[root@RabbitMQ1 /root/] otp_src_R14B/configure –with-ssl
5. Make and Install Erlang by running following command
[root@RabbitMQ1 /root/] otp_src_R14B/make install

6. Download RabbitMQ server by running following command
[root@RabbitMQ1 /root/] wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.1.1/rabbitmq-server-generic-unix-2.1.1.tar.gz
7. Extract downloaded file using following command in the /usr/local/
8. Fix RabbitMq Erlang process port by adding -kernel inet_dist_listen_min PORT and -kernel inet_dist_listen_max PORT parameters in the file $RABBITMQ_HOME/sbin/rabbitmq-server file

SERVER_ERL_ARGS=”+K true +A30 +P 1048576 \

-kernel inet_default_listen_options  \

-kernel inet_default_connect_options [{nodelay,true}] \

-kernel inet_dist_listen_min 35197 \

-kernel inet_dist_listen_max 35197

9. Open following firewall port by running following commands on the command prompt

iptables -I INPUT 1 -p tcp –dport 5672 -j ACCEPT
iptables -I INPUT 1 -p tcp –dport 4369 -j ACCEPT
iptables -I INPUT 1 -p tcp –dport 35197 -j ACCEPT
/etc/init.d/iptables save
/etc/init.d/iptables restart

10. Follow above steps on each rabbit MQ node.
11. For communication between two nodes they must have the same cookie.
12. Cookie file exist at following location
/root/.erlang.cookie
13. Copy .erlang.cookie from master node RabbitMQNode1 the second node RabbitMQNode2 in the cluster at same location.
14. Remove directory /var/lib/rabbitmq/mnesia on each node
15. Start RabbitMQ server on both nodes by running following command from $RABBITMQ_HOME command prompt
[root@RabbitMQ1 /root/] sbin/ rabbitmq-server –detached
16. Stop RabbitMQ application on node RabbitMQNode2 by running following command from $RABBITMQ_HOME command prompt
[root@RabbitMQ1 /root/] sbin/rabbitmqctl stop_app
17. Reset the RabbitMQNode2 by running following command from $RABBITMQ_HOME command prompt
[root@RabbitMQ1 /root/] sbin/rabbitmqctl reset
18. Run following command from from $RABBITMQ_HOME command prompt at node RabbitMQNode2 to join the rabbit@ RabbitMQNode1 cluster
[root@RabbitMQ1 /root/] sbin/ rabbitmqctl cluster rabbit@RabbitMQNode1
19. Start the RabbitMQ application node RabbitMQ2 by running command from $RABBITMQ_HOME command prompt
[root@RabbitMQ1 /root/] sbin/rabbitmqctl start_app

20. To check RabbitMQ cluster status run follwong command from $RABBITMQ_HOME command prompt
[root@RabbitMQ1 /root/] rabbitmqctl status

sbin/rabbitmqctl status
Status of node rabbit@ RabbitMQNode2 …
[{running_applications,[{rabbit,”RabbitMQ”,”2.1.1″},
{mnesia,”MNESIA CXC 138 12″,”4.4.15″},
{os_mon,”CPO CXC 138 46″,”2.2.5″},
{sasl,”SASL CXC 138 11″,”2.1.9.2″},
{stdlib,”ERTS CXC 138 10″,”1.17.1″},
{kernel,”ERTS CXC 138 10″,”2.14.1″}]},
{nodes,[{disc,[rabbit@ RabbitMQNode1]}, {ram, [rabbit@ RabbitMQNode2]}]},
{running_nodes,[rabbit@ RabbitMQNode1, rabbit@ RabbitMQNode2]}]
…done.

Advertisements
Posted in Uncategorized | 7 Comments