The RabbitMQ messaging middleware, in fact, recently the project useful to, but has not been systematically organized recently read the "combat efficiently deploy distributed RabbitMQ message queue," this book, so I dropped to write about.
So what about RabbitMQ that? First, you can refer to the official website: http://www.rabbitmq.com . Here, I probably tell us about:
RabbitMQ is a complete standards based on the AMQP protocol, you can take the enterprise messaging system. It follows the open source Mozilla Public License Agreement, the use of industrial-grade Erlang implementation of the Message Queue (MQ) server.
①, AMQP, namely Advanced Message Queuing Protocol, to provide a unified messaging service application layer standard Advanced Message Queuing Protocol, is an open standard application layer protocol for message-oriented middleware design. Based on this protocol client and messaging middleware message can be transmitted, is not subject to the limitations of the client / middleware different products, different development language. About AMQP can refer to: https://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol , as well as the official website: http://www.amqp.org/confluence/display/AMQP/Advanced+Message+Queuing+Protocol .
②, open source.
③, using Erlang language, which is oriented concurrent programming language, aims to create a way to deal with large-scale programming language and runtime environment concurrent activities.
Next, we describe how to install RabbitMQ on a Linux system.
1, the installation Erlang
We wanted to write Java programs need to install JDK as a reference, install RabbitMQ, we also need to install Erlang.
①, download the installation package erlang
The installation package downloaded to / home / erlang directory.
1 wget http://www.erlang.org/download/otp_src_R16B02.tar.gz
②, unzip
1 tar -zxvf otp_src_R16B02.tar.gz
③, compile and install
First, enter the file unzipped, and then install the following plug-ins
Then set the build directory to / usr / local / erlang
Finally, run make and make install command.
All command steps:
1、cd otp_src_R16B02 2、yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel 3、./configure --prefix=/usr/local/erlang --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll 4、make 5、make install
④, configure the environment variables
Files into the vim / etc / profile command, and then typing the following code
Finally, by the command environment variables to take effect:
source /etc/profile
⑤, verification
Enter erl command in any directory, as is the case, then the installation was successful erlang:
2, install RabbitMQ
①, download the installation package
Creating / home / rabbitmq directory, execute the following command in the directory:
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.5/rabbitmq-server-3.1.5.tar.gz
②, unzip
tar -zxvf rabbitmq-server-3.1.5.tar.gz
③, compile and install
1 cd rabbitmq-server-3.1.5 2 yum -y install xmlto 3 make 4 make install TARGET_DIR=/opt/mq/rabbitmq SBIN_DIR=/opt/mq/rabbitmq/sbin MAN_DIR=/opt/mq/rabbitmq/man
The rabbitmq compiled into the / opt / mq / rabbitmq directory.
④, open web plug-in
1 cd /opt/mq/rabbitmq/sbin 2 mkdir /etc/rabbitmq/ 3 ./rabbitmq-plugins enable rabbitmq_management
3, startup and shutdown RabbitMQ
1 start monitoring manager: RabbitMQ-plugins enable rabbitmq_management 2 Close monitoring manager: RabbitMQ-plugins disable rabbitmq_management . 3 starting RabbitMQ: RabbitMQ--Service Start . 4 Close RabbitMQ: RabbitMQ--Service STOP . 5 See all queues: rabbitmqctl list_queues . 6 to remove all queue: rabbitmqctl RESET . 7 Close application: rabbitmqctl stop_app . 8 start the application: rabbitmqctl start_app
Start rabbitmq services by Article 3 of the command, then enter in the browser
ip:15672
The screen can be as follows. Ip where ip is installed rabbitmq machine address of 15672 is the default port rabbitmq.
ps: If you can not open the following screen, may be a firewall is not closed. centos6 turn off the firewall command:
Close the command: service iptables stop permanently turn off the firewall: chkconfig iptables off to view the status of the firewall: service iptables status
The default user name and password are guest. We can log in with guest: