What is RABBITMQ?
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.
RABBITMQ concept
- Broker: The Message Queuing server entity is simply the case.
- Exchange: A message switch that specifies what rules the message is routed to and to which queue.
- Queue: A message queue carrier in which each message is put into one or more queues.
- Binding: Bind, which is the role of binding exchange and queue according to routing rules.
- Routing key: The routing keyword, exchange messages are delivered based on this keyword.
- Vhost: Virtual host, a broker can open multiple vhost, as a separate user permissions.
- Producer: The message producer is the program that delivers the message.
- Consumer: The message consumer is the program that receives the message.
- Channel: The message channels, in each connection of the client, multiple channels can be established, each channel represents a session task.
Host name |
IP |
Use |
Rabbitmq01 |
192.168.200.128 |
Disk node |
Rabbitmq02 |
192.168.200.129 |
Memory nodes |
Rabbitmq03 |
192.168.200.130 |
Memory nodes |
- Installing RABBITMQ
1: Need to configure three nodes of the Hosts file, the following content is added to three servers respectively.
vim /etc/hostname //其他两台为rabbitmq02、rabbitmq03 rabbitmq01.localdomain# vim /etc/hosts //添加下面三行192.168.200.128 rabbitmq01192.168.200.129 rabbitmq02192.168.200.130 rabbitmq03# init 6 //重启# service firewalld stop# setenforce 0
2: Install the RABBITMQ software.
# yum install epel-release -y //安装epel源# yum install -y rabbitmq-server //安装软件# rabbitmq-plugins list //查看插件安装情况# rabbitmq-plugins enable rabbitmq_management //启用rabbitmq_management服务# systemctl start rabbitmq-server.service //启动rabbitmq服务# netstat -ntap | grep 5672# rabbitmqctl cluster_status //检查三台的集群状态,目前相互独立,没有形成集群。
Building an Erlang cluster
# systemctl stop rabbitmq-server.service //停止三台服务器# vi /var/lib/rabbitmq/.erlang.cookie //三台值配置成一样的,复制rabbitmq01的内容到其他两台# systemctl start rabbitmq-server.service
operate on 02, 03 nodes
# rabbitmqctl stop_app# rabbitmqctl join_cluster --ram [email protected] //加入到磁盘节点# rabbitmqctl start_app
- Open a browser into web page management
- Input: http://192.168.200.128:15672/
- Default User name: Guest Password: Guest
- Add a queue message
- 2-persistent: Indicates persistence, which in turn shows non-persistence.
- Headers: Fill it out
- Properties: Click on the question mark, now an ID number
- Payload: Message Content
Sleep the rest of tomorrow write
Tens of thousands of PV sites RABBITMQ installation, cluster