RabbitMQ is a mainstream enterprise message team product. Its implementation based on the Erlang language enables it to have efficient message processing capabilities; based on RabbitMQ's high efficiency and reliability guarantee for messages, it has been widely used in enterprises. Next, Brother Tao will tell you about the detailed installation and configuration tutorial of RabbitMQ~
1. Introduction to RabbitMQ
RabbitMQ is a reusable enterprise messaging system based on AMQP. He follows the Mozilla Public License open source agreement.
AMQP, or Advanced Message Queuing Protocol, is an application layer standard advanced message queuing protocol that provides unified messaging services. It is an open standard for application layer protocols and is designed for message-oriented middleware. The client and message middleware based on this protocol can transmit messages, and it is not limited by different client/middleware products, different development languages and other conditions. Implementations in Erlang include RabbitMQ, etc.
The main features are as follows:
- Guaranteed reliability: Use some mechanisms to ensure reliability, such as persistence, transmission confirmation, release confirmation
- Flexible Routing Function
- Scalability: support message cluster, multiple RabbitMQ servers can form a cluster
- High availability: the queue is still available when a node in the RabbitMQ cluster fails
- Support multiple protocols
- Support multilingual clients
- Provides a nice admin interface
- Provide tracking mechanism: If the message is abnormal, the cause of the exception can be analyzed through the tracking mechanism
- Provide plug-in mechanism: it can be extended in many ways through plug-ins
2. Environment preparation before installation
- Linux:CentOS 7.6
- RabbitMQ:RabbitMQ 3.7
If you have installed erlang before, please delete it first!
yum remove erlang*
Install the C++ compilation environment
# yum -y install make gcc gcc-c++
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson
Download erlang and rabbitMQ
wget http://www.erlang.org/download/otp_src_20.1.tar.gz
Download RabbitMQ
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.0/rabbitmq-server-generic-unix-3.7.0.tar.xz
3. Install the erlang environment
Create the /usr/local/erlang directory where we will install erlang.
Unzip the erlang installation package
tar -xvf otp_src_20.1.tar.gz
Go to the unzipped folder
cd otp_src_20.1
Erlang needs to rely on JDK, so you need to complete the installation of JDK and configuration of environment variables first. Specify the installation directory and installation configuration
./configure --prefix=/usr/local/erlang --enable-smp-support --enable-threads --enable-sctp --enable-kernel-poll --enable-hipe --with-ssl --without-javac
Compile and install
make && make install
Configure the erlang environment variable: add export PATH=$PATH:/usr/local/erlang/bin to the end of the file
vi /etc/profile
reload profile file
source /etc/profile
4. Install RabbitMQ
4.1 Decompress RabbitMQ
Since the downloaded installation package is an xz file, we first decompress xz into tar.
xz -d rabbitmq-server-generic-unix-3.7.0.tar.xz
tar -xvf rabbitmq-server-generic-unix-3.7.0.tar
4.2 Start RabbitMQ
Go to the sbin directory of the decompressed RabbitMQ
cd rabbitmq_server-3.7.0/sbin
Start RabbitMQ
./rabbitmq-server -detached
View the process, the default port of RabbitMQ is 5672
lsof -i:5672
# 或者
ps aux|grep rabbit
#ps a 显示现行终端机下的所有程序,包括其他用户的程序。
#ps u 以用户为主的格式来显示程序状况。
#ps x 显示所有程序,不以终端机来区分。
5. Start the RabbitMQ management system
Start the RabbitMQ management system plug-in (need to enter the sbin directory)
./rabbitmq-plugins enable rabbitmq_management
Access management system: http://119.23.237.251:15672/
6. Cloud Host Security Group Settings
If the RabbitMQ server is based on a cloud host, normal access to the management system requires security group settings.
6.1 Alibaba Cloud Server
6.2 Huawei Cloud Server
7. Summary
The process of installation and configuration focuses on the details, don't make mistakes in the instructions and directories! The above is the detailed process of installing RabbitMQ based on Linux, have you learned it? "Give someone a rose, leave a lingering fragrance in your hand" - I learned to give Brother Tao a thumbs up ^_^