Brief introduction
MQ is all called the message queue, and Message Queuing (MQ) is an application-to-application communication method. Applications communicate by reading and writing messages to and from the queue (data for the application), without requiring a dedicated connection to link them. Message passing refers to the process of communicating between programs by sending data in a message, rather than by directly invoking each other, and directly invoking techniques such as remote procedure calls. Queuing refers to an application communicating through a queue. The use of queues removes the requirement that both the receiving and sending applications execute concurrently. Some of the more mature MQ products are IBM WEBSPHERE MQ and so on.
Characteristics
MQ is a typical representative of the consumer-producer model, where one end writes messages to the message queue, while the other end reads or subscribes to messages in the queue. MQ is similar to JMS, but the difference is that JMS is a standard and API definition for the Sun Java Messaging Middleware Service, and MQ follows the specific implementations and products of the AMQP protocol.
Experimental environment
Host name |
IP Address |
Operating System |
Use |
Mq01 |
192.168.100.75 |
Centos_7.4_x86_64 |
Disk node |
Mq02 |
192.168.100.76 |
Centos_7.4_x86_64 |
Memory nodes |
Mq03 |
192.168.100.77 |
Centos_7.4_x86_64 |
Memory nodes |
Build step one, prepare for work 1, close the firewall and SELinux
[[Email protected]_5 ~]# systemctl Stop Firewalld.service
[Email protected]_5 ~]# systemctl Disable Firewalld.servic
[Email protected] ~]# Vim/etc/sysconfig/selinux
2. Modify hostname and Hosts file
[Email protected]_5 ~]# vim/etc/hostname
mq01.localdomain #添加主机名,第一台mq01依次为mq02、mq03
[Email protected]_5 ~]# vim/etc/hosts #其他三台都是这样配
#末行添加192.168.100.75 mq01192.168.100.76 mq02192.168.100.77 mq03
[Email protected]_5 ~]# Shutdown-r now #重启服务
Second, configuration rabbtimq (three configurations same) 1, install ROBBTIMQ software
[Email protected] ~]# yum-y install epel-release #安装epel源文件
[Email protected] ~]# yum-y install Rabbitmq-server #安装rabbtimq服务器端
2, optimize the path
[Email protected] ~]# ln-s/usr/lib/rabbitmq/bin/*/usr/bin/#优化路径
3. Start related services
[Email protected] ~]# rabbitmq-plugins enable Rabbitmq_management #启动web端管理服务
[Email protected] ~]# systemctl start Rabbitmq-server.service #启动rabbitmq服务
[Email protected] ~]# rabbitmq-plugins list #查看rabbitmq安装模块及其版本号
[Email protected] ~]# rabbitmqctl cluster_status #检查三台的集群状态, currently independent of each other, did not form a cluster.
Cluster status of node [email protected] … [{nodes,[{disc,[[email protected]]}]}, {running_nodes,[[email protected]]}, {cluster_name,<<"[email protected]">>}, {partitions,[]}]...done.
[Email protected] ~]# NETSTAT-ANPT | grep 5672 #查看端口号
Third, build the cluster (all three are configured the same) 1, edit the cookie ID
[Email protected] ~]# systemctl stop Rabbitmq-server.service #停止三台服务
[[email protected] ~]# Vim/var/lib/rabbitmq/.erlang.cookie #三台值配置成一样的, copy the mq01 cookie ID to the other two
ORPMEUFAADFUFEXAUHIJ
[Email protected] ~]# systemctl start Rabbitmq-server #启动三台服务
2. Configuring the Cluster
[Email protected] ~]# Rabbitmqctl Stop_app #两台内存节点操
stopping node [email protected] ...
... done.
[Email protected] ~]# rabbitmqctl join_cluster--ram [email protected] #以内存节点形式加入到磁盘节点
Rabbitmqctl Start_app
[Email protected] ~]# Rabbitmqctl cluster_status
Cluster status of node [email protected] ...[{nodes,[{disc,[[email protected]]},{ram,[[email protected],[email protected]]}]}, #mq01属于磁盘节点,mq02、mq03属于内存节点 {running_nodes,[[email protected],[email protected],[email protected]]}, #显示各节点,构成了群集 {cluster_name,<<"[email protected]">>}, {partitions,[]}]...done.
3. Login Access
http://192.168.100.76:15672/
Building a RABBITMQ Message Queuing cluster