Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Practice of building rabbitmq3.7 cluster

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Environment:

3 centos7.4

Rabbitmq3.7

Erlang 22

There are several ways to install, the yum installation used here (official recommendation)

When using rabbitmq, you need to install erlang and use vim to add two repo files on each node

/ etc/yum.repos.d/rabbitmq_erlang.repo

[rabbitmq_erlang] name=rabbitmq_erlangbaseurl= https://packagecloud.io/rabbitmq/erlang/el/7/$basearchrepo_gpgcheck=1gpgcheck=0enabled=1gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkeysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crtmetadata_expire=300[rabbitmq_erlang-source]name=rabbitmq_erlang-sourcebaseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMSrepo_gpgcheck=1gpgcheck=0enabled=1gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkeysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crtmetadata_expire=300

/ etc/yum.repos.d/rabbitmq.repo

[bintray-rabbitmq-server] name=bintray-rabbitmq-rpmbaseurl= https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/gpgcheck=0repo_gpgcheck=0enabled=1 uses yum installation: yum install erlang rabbitmq-server-y setting self-startup: systemctl enable rabbitmq-server each node follows 2 and 3 steps to set up the cluster after the installation is completed. Start the rabbitmq server in one node first: systemctl start rabbitmq-server to check the node startup. Active behavior running starts normally: systemctl status rabbitmq-server default path / var/lib/rabbitmq/.erlang.cookie, copy this file to the same directory of other nodes: scp / var/lib/rabbitmq/.erlang.cookie root@server2:/var/lib/rabbitmq/

The copied file has a permission problem and needs to be modified. An error will be reported if you do not modify the startup:

[error] Error when reading / var/lib/rabbitmq/.erlang.cookie: eacces

Modify permission: chown rabbitmq:rabbitmq / var/lib/rabbitmq/.erlang.cookie start rabbitmq server node by node: ssh root@server2 "systemctl start rabbitmq-server" cluster configuration: need to use domain name, modify / etc/hosts and / etc/hostname, add the domain name of each node, ip, select server1 as the master node, do not need to operate, enter other nodes, and perform app:rabbitmqctl stop_app shutdown Then join the cluster: rabbitmqctl join_cluster rabbit@server1 server1 changes according to its own name, and rabbit is a fixed user name. After all the nodes have been executed, enter the master node, use rabbitmqctl cluster_status to check the cluster status, and list each node as a success. Remove nodes: can be removed by using rabbitmqctl reset in a node

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report