Introduction to RABBITMQ Cluster construction method (test machine Linux CentOS) "Turn"

Source: Internet
Author: User
Tags set cookie rabbitmq

This article will introduce four machines to build RABBITMQ clusters:

Rabbitmq

IP and hostname (per machine installed RABBITMQ 3.5.6, Erlang 18.1)

    1. 192.168.87.73 localhost73

    2. 192.168.87.74 localhost74

    3. 192.168.87.75 localhost75

    4. 192.168.87.76 localhost76

Add the above IP and host names to the Hosts file (vim/etc/hosts)

RABBITMQ clusters are dependent on Erlang's clusters to work, so you must first build a clustered environment of Erlang. The nodes in Erlang's cluster are implemented by a magic cookie, which is stored in/var/lib/rabbitmq/.erlang.cookie and the file is 400 privileged. Therefore, it is necessary to ensure that each node cookie is consistent, otherwise the nodes cannot communicate.

Set Cookie:vi/var/lib/rabbitmq/.erlang.cookie

In this example, assuming that the first node cookie is: ZTNMCISEYCEMUZMMHFAHABC, execute the following command at each node:

# chmod 700/var/lib/rabbitmq/.erlang.cookie

# echo-n "ZTNMCISEYCEMUZMMHFAHABC" >/var/lib/rabbitmq/.erlang.cookie

# chmod 400/var/lib/rabbitmq/.erlang.cookie

Open the cluster communication port on the firewall

Start firewall: Systemctl start Firewalld.service

# Firewall-cmd--permanent--add-port={4369/tcp,25672/tcp,5672/tcp}

# Firewall-cmd--reload

Component clusters

We use localhost73 as the primary node and execute the following command on localhost74:

localhost74 # Rabbitmqctl Stop_app

localhost74 # rabbitmqctl Join_cluster [email protected]

localhost74 # Rabbitmqctl Start_app

Then, the localhost75 and localhost76 are executed sequentially.

Change node Properties

#rabbitmqctl stop_app– Stop RABBITMQ Service

#rabbitmqctl Change_cluster_node_type disc– Change node to disk node

Rabbitmqctl Change_cluster_node_type ram– change node to memory node

#rabbitmqctl start_app– Open RABBITMQ Service

In this example we will change the main node localhost73 to a disk node, so that we have completed the cluster, such as:

View cluster status

RABBITMQ Web Management plug-in starts

Rabbitmq-plugins Enable rabbitmq_management start

Rabbitmq-plugins Disable rabbitmq_management off

After opening we can access RABBITMQ Web management, Access address: http://192.168.87.73:15672, user name password: guest,guest

If you do not have a native access then you need to add a new user, because the guest this user can only be in the local access, so we want to add a user and give permission.

Add Web Admin user

Add User: Rabbitmqctl add_user admin 123456

Add Permissions: Rabbitmqctl set_permissions-p "/" admin ". *" ". *" ". *"

Modify User Role Rabbitmqctl set_user_tags admin Administrator

After adding the user login by address http://192.168.87.73:15672 and the username and password you just created, you can view the cluster we configured:

Web management view Clusters

Turn from

http://www.toutiao.com/i6461441222467650061/

Introduction to RABBITMQ Cluster construction method (test machine Linux CentOS) "Turn"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.