RabbitMQ is an open source message queue server that you can use to build your messaging applications. In simple terms, you can put a message to the queue from one application, and retrieve the message from the queue from the same application, or from a different application. You can use wide varieties of programming languages to connect to RabbitMQ, create and retrieve the messages.
Install Erlang
For RabbitMQ to work, you need to have Erlang installed on your system.
The current stable version of Erlang is R16B, which can be downloaded from Erlang website.
cd /usr/save wget http://www.erlang.org/download/otp_src_R16B.tar.gz tar xvfz /usr/save/otp_src_R16B.tar.gz
After downloading Erlang, install Erlang R16B version from source as shown below.
cd otp_src_R16B LANG=C; export LANG ./configure make make install
Verify Erlang
Now, when you type erl from the command line, you should get the Erlang Shell as shown below. This indicates that you’ve installed Erlang successfully.
# erl Erlang R16B (erts-5.10.1) [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V5.10.1 (abort with ^G) 1> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution a
Download RabbitMQ
The current stable version of RabbitMQ server is 3.0.4. When you go to RabbitMQ website, you’ll see the following versions are available for download for Linux platform: 1) Debian / Ubuntu 2) Fedora / RHEL 3) Generic Unix 4) Solaris
In this example, I’ve chosen RabbitMQ for Generic Unix.
cd /usr/save wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.4/rabbitmq-server-generic-unix-3.0.4.tar.gz tar xvfz rabbitmq-server-generic-unix-3.0.4.tar.gz cd rabbitmq_server-3.0.4
Start RabbitMQ Server
Start the RabbitMQ server by passing -detached option as shown below.
# cd /usr/save/rabbitmq_server-3.0.4 # sbin/rabbitmq-server -detached Warning: PID file not written; -detached was passed.
If you are getting could_not_start_tcp_listener error message, while starting the RabbitMQ server, see the troubleshooting section below for solution on how to fix this issue.
Verify RabbitMQ Status
Use the rabbitmqctl command to verify the status of the RabbitMQ server and to stop it if required.
# sbin/rabbitmqctl status Status of node 'rabbit@db-dev' ... [{pid,30069}, {running_applications,[{rabbit,"RabbitMQ","3.0.4"}, {mnesia,"MNESIA CXC 138 12","4.8"}, {os_mon,"CPO CXC 138 46","2.2.11"}, {sasl,"SASL CXC 138 11","2.3.1"}, {stdlib,"ERTS CXC 138 10","1.19.1"}, {kernel,"ERTS CXC 138 10","2.16.1"}]}, {os,{unix,linux}}, {erlang_version,"Erlang R16B (erts-5.10.1) [source] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]\n"}, {memory,[{total,15087368}, {connection_procs,1432}, {queue_procs,2864}, {plugins,0}, {other_proc,4748681}, {mnesia,30672}, {mgmt_db,0}, {msg_index,8652}, {other_ets,369668}, {binary,5976}, {code,6973062}, {atom,387397}, {other_system,2558964}]}, {vm_memory_high_watermark,0.4}, {vm_memory_limit,1699810508}, {disk_free_limit,1000000000}, {disk_free,913096704}, {file_descriptors,[{total_limit,924}, {total_used,3}, {sockets_limit,829}, {sockets_used,1}]}, {processes,[{limit,1048576},{used,124}]}, {run_queue,0}, {uptime,6}] ...done.
To stop a RabbitMQ Server, use the rabbitmqctl command as shown below.
# sbin/rabbitmqctl stop
Troubleshooting
Issue: On CentOS 6, if you’ve used yum to install rabbitmq, or from source as explained above, and if you are getting “BOOT FAILED {could_not_start_tcp_listener,{“::”,5672}}” message, you might have port conflict issue.
Solution: Matahari package that is installed by default on CentOS 6, also runs on port 5672. This process is started by default. Try stopping the qpidd (Qpid AMQP daemon), and see if it solves the problem. If you don’t need Matahari, you can also uninstall matahari, matahari-broker, qpid-cpp-server-ssl and qpid-cpp-server packages.
Stop the qpidd daemon, and disable it from system startup using chkconfig command.
# chkconfig --list | grep -i qpid qpidd 0:off 1:off 2:on 3:on 4:on 5:on 6:off # service qpidd stop Stopping Qpid AMQP daemon: [ OK ] # chkconfig qpidd off # chkconfig --list | grep -i qpid qpidd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Now, if you start the RabbitMQ server, it should work.
0 comments:
Post a Comment