In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Outline:
I. MQ Profile
What is RabbitMQ?
Third, install RabbitMQ
IV. Deploying Rabbitmq Cluster
1) Deployment environment
2) Install rabbitmq service
3) Configure the host file and add the above two nodes to the cluster.
4) rabbitmq 01 configure cluster and add rabbitmq 02, 03 to 01 cluster
5) Access to the web interface
6) Add vhost to web pages
V. Single node joining or exiting cluster
1) Single node joins cluster
2) Single node exits cluster
I. MQ Profile
MQ stands for Message Queue, which is an application-to-application communication method. Applications communicate by reading and writing messages (application-specific data) in and out of queues, without the need for dedicated connections to link them. Messaging refers to programs communicating with each other by sending data in messages, rather than by calling each other directly, which is often the technique used for things like remote procedure calls. Queue refers to applications communicating through queues. The use of queues eliminates the requirement that receiving and sending applications execute simultaneously.
What is RabbitMQ?
RabbitMQ is open source message broker software (also known as message-oriented middleware) written in Erlang that implements the Advanced Message Queue Protocol (AMQP). Support Windows, Linux/Unix, MAC OS X operating systems and multiple programming languages including JAVA.
AMQP (Advanced Message Queuing Protocol) is an application layer standard for unified messaging services, an open standard for application layer protocols designed for message-oriented middleware. Based on this protocol, client and messaging middleware can transfer messages, and are not limited by different client/middleware products and different development languages.
RabbitMQ usage scenarios:
1) asynchronous processing;
2) apply decoupling;
3) flow peak clipping;
4) information communication;
Third, install RabbitMQ
Required software download link: https://www.example.com Extraction code: ng8c
[root@localhost ~]# ls #Confirm required RPM package erlang-18.1 - 1. el 6. x86_64. rpmrabbitmq-server-3.6.6 - 1.el6.noarch.rpmsocat-1.7.3.2 - 2.el7.x86_64.rpm [root@localhost~]#yum-y localinstall erlang-18.1-1.el6.x86_64.rpm rabbitmq-server-3.6.6-1.el6.noarch.rpm socat-1.7.x86_64.rpm#Install RPM package [root@localhost~] localhost~]#chkconfig rabbitmq-server on #rabbitmq join boot autostart [root@localhost~]#/etc/init. d/rabbitmq-server start #start rabbitmq service [root@localhost~]#ps-ef| grep rabbitmq #Confirm rabbitmq is running, return more results, omit [root@localhost~]#rabbitmq-plugins enable rabbitmq_management #Open rabbitmq web management plug-in, so that you can access it through the browser [root@localhost~]#rabbitmqctl add_user admin 123.com#Create login user #Default WEB management login account and password unified as: guest [root@localhost~]#rabbitmqctl set_user_tags admin administrator #Add the admin user created to the administrator group
The default RabbitMQ has the following port numbers:
15672 and 5672 are commonly used.
Client access:
Rabbitmq cluster deployment is roughly divided into two ways: 1, normal mode: default cluster mode, the body of the message only exists on one node; 2, mirror mode: the queue needs to be mirrored, existing in multiple nodes. ha-mode: all: queue to all nodes; exactly: mirror randomly to other nodes; nodes: mirror to specified nodes. Cluster node mode: 1. Memory node: works on memory; 2. Disk node: works on disk; Exception: Memory node and disk node exist together to improve access speed and increase data persistence.
Compared with memory nodes, although they do not write to disks, they perform better than disk nodes. In a cluster, only one disk is needed to save state. If there are only memory nodes in the cluster, all state and messages will be lost once the nodes are down, and data persistence cannot be realized.
1) Deployment environment System IP address Host name Centos 7192.168.1.4rabbitmq01Centos 7192.168.1.5rabbitmq02Centos 7192.168.1.6rabbitmq03Centos 7192.168.1.7rabbitmq04
192.168.1.4 is based on the single rabbitmq above.
2) Install rabbitmq service
Deployed on nodes 192.168.1.5 and 192.168.1.6, 192.168.1.7 will be used later!
[root@localhost ~]# ls #Confirm required RPM package erlang-18.1 - 1. el 6. x86_64. rpmrabbitmq-server-3.6.6 - 1.el6.noarch.rpmsocat-1.7.3.2 - 2.el7.x86_64.rpm [root@localhost~]#yum-y localinstall erlang-18.1-1.el6.x86_64.rpm rabbitmq-server-3.6.6-1.el6.noarch.rpm socat-1.7.x86_64.rpm#Install RPM package [root@localhost~] localhost~]#chkconfig rabbitmq-server on #rabbitmq join boot autostart [root@localhost~]#/etc/init. d/rabbitmq-server start #start rabbitmq service 3) configure host file and add the above two nodes to cluster [root@localhost~]#echo-e "www.example.com rabbitmq01\n192.168.1.5 rabbitmq02\n192.168.1.6 rabbitmq03\n192.168.1.7 rabbitmq04">192.168.1.4
All nodes in the cluster need to be restarted (including rabbitmq01). If you are stuck in an interface during restart, you need to manually force restart!
[root@rabbitmq01~]#ps-ef| grep rabbitmq #After restarting, the host name is automatically updated to confirm rabbitmq is running 4) rabbitmq 01 configure the cluster and add rabbitmq 02 and 03 to 01 cluster
The following operations can be distinguished according to the host name!
[root@rabbitmq01 ~]# rabbitmqctl stop_app #Stop rabbitmq node service [root@rabbitmq01~]#rabbitmqctl reset #reset rabbitmq node [root@rabbitmq01~]#rabbitmqctl start_app #Starting rabbit node rabbit@rabbitmq01... #Node name returned by copying ########### #Stop node service [root@rabbitmq02~]#rabbitmqctl reset #Reset node [root@rabbitmq02~]#rabbitmqctl join_cluster--ram rabbit@rabbitmq01#Join cluster in memory, followed by node name of copied rabbitmq01 [root@rabbitmq02~]#rabbitmqctl start_app [root@rabbitmq02~]#rabbitmq-plugins enable rabbitmq_management #Enable rabbitmq's web management plug-in so that it can be accessed via browser##########rabbitmq02, 03 After execution #################[root@rabbitmq01~]#rabbitmqctl cluster_status #View cluster status of node rabbit@rabbitmq01... [{nodes,[{disc,[rabbit@rabbitmq01]}, {ram,[rabbit@rabbitmq03,rabbit@rabbitmq02]}]}, {running_nodes,[rabbit@rabbitmq02,rabbit@rabbitmq03,rabbit@rabbitmq01]}, {cluster_name,}, {partitions,[]}, {alarms,[{rabbit@rabbitmq02,[]}, {rabbit@rabbitmq03,[]}, {rabbit@rabbitmq01,[]}]}]#rabbit01 working mode is disk node; rabbit02 and 03 are memory node mode #running_nodes: running node #cluster_name: node name #alarms: Rabbit01, 02 and 03 will alarm when a problem occurs ####Because rabbitmq01 is reset just now, So you need to recreate the user ########[root@rabbitmq01~]#rabbitmqctl add_user admin 123.com [root@rabbitmq01~]#rabbitmqctl set_user_tags admin administrator 5) Access the web interface
You can log in to any node on IP +15672 in the cluster!
6) Add vhost to web pages
Set matching policy:
Set the content of the published message:
V. Single node joining or exiting cluster 1) Single node joining cluster
Since I deployed the cluster above, the hosts file can already resolve the nodes within the cluster, so I will omit parsing here!
###########################[root@localhost~]#yum-y localinstall erlang-18.1-1.el6.x86_64.rpm rabbitmq-server-3.6.6-1.el6.noarch.rpm socat-1.7.3.2 - 2.el7.x86_64.rpm [root@localhost~]#chkconfig rabbitmq-server on [root@localhost~]#localhost~]#/etc/init. d/rabbitmq-server start [root@localhost~]#scp root@rabbitmq01:/var/lib/rabbitmq/. erlang. cookie/var/lib/rabbitmq/#Copy cookie information locally from the cluster, Then restart [root@rabbitmq04~]#rabbitmqctl stop_app [root@rabbitmq04~]#rabbitmqctl reset [root@rabbitmq04~] 4~]#rabbitmqctl join_cluster--ram rabbit@rabbitmq01#Join the cluster as a memory run, to join as a disk, Omit "--ram" option [root@rabbitmq04~]#rabbitmqctl start_app #Open web management page [root@rabbitmq04~]#rabbitmq-plugins enable rabbitmq-app mq_management
View the web interface:
2) Single node exits cluster
[root@rabbitmq04 ~]# rabbitmqctl stop_app
#Stop the node above rabbitmq04 first
[root@rabbitmq01 ~]# rabbitmqctl -n rabbit@rabbitmq01 forget_cluster_node rabbit@rabbitmq04
#-n: Specify node name
#forget_cluster_node: followed by the name of the node to be deleted
#Go back to the master node (rabbitmq01) and delete the node
View the web interface:
- ------------
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.