Create a RABBITMQ cluster in a single-machine environment in Windows

Source: Internet
Author: User
Tags rabbitmq

This article is based on: http://www.360doc.com/content/15/0312/17/20874412_454622619.shtml finishing

RABBITMQ has a very good messaging performance, but also open source software, the use of a wide range.
Because you are using a Windows system, in a nutshell, the point of entry is naturally the bat file provided by RABBITMQ. RABBITMQ provides 5 bat files, respectively: Rabbitmq-service.bat,rabbitmq-server.bat,rabbitmq-plugins.bat,rabbitmq-echopid.bat and Rabbitmqctl.bat. Let's start with Rabbitmq-server.bat and Rabbitmqctl.bat.
We are going to build a cluster with two node nodes, named Cluster-node1 and ClusterNode2, respectively. Each node certainly has its own bat file, so the above two bat becomes 4:
Rabbitmq-server-cluster-1.bat,rabbitmq-server-cluster-2.bat,rabbitmqctl-cluster-1.bat and Rabbitmqctl-cluster-2.bat. Let's talk about how to modify it here.

1. Cooperate with Hosts file

You need to modify the Hosts file in Windows. Since you want to simulate two node on a machine, it is natural to configure two node IP, add the following two paragraphs in the Hosts file:
    127.0.0.1 Cluster-node1
127.0.0.1 Cluster-node2
Save.

2. Modify Rabbitmq-server.bat

Add in rabbitmq-server*
    set rabbitmq_config_file= "C:\Program files\rabbitmq server\rabbitmq_server-3.6.2\etc\cluster-1" // Where the path is the path of the config file for the current node
This parameter is primarily used to configure the config file for RABBITMQ, which is not included in *-server.bat by default, so it needs to be created manually. The various parameters of RABBITMQ can be configured in config file, which is helpful for future study. The second parameter here is the path where the config file is set.
And then add (or directly modify is OK)
    Set [email protected]

 When configuring the RABBITMQ cluster in a stand-alone environment, ensure that each node has a unique node name and port number. The statement is the name of the node that sets the RABBITMQ node.

  Note: the @ symbol in RABBITMQ divides the node identifier ([email protected]) into two parts. On the left is the application name of Erlang and the server hostname or IP address on the right.
Then modify the node port number:

    Set rabbitmq_node_port=9991
At last

    Set rabbitmq_dist_port=15672
So the Rabbitmq-server two files are finished, click Save.

3. Modify Rabbitmqctl.bat

Modified in rabbitmqctl-cluster-*. These two files are simple:
    Set [email protected] 

4. Create a cluster

First, run the rabbitmqctl-cluster-* file first and start up two servers. After running Rabbitmqctl-cluster-2 Stop_app, the Node2 is first hung up. Run again
    rabbitmqctl-cluster-2 join_cluster [email protected]

This adds the Node2 to the Node1 cluster.

Note: When joining a new node, first stop the RABBITMQ program running on the Erlang node and reset (empty) their metadata. So that they can be joined and get the metadata for the cluster.

5. Activating the node    

  R abbitmqctl-cluster-2 Start_app

6. View cluster status

  Where the disc node represents the disk node, and RAM represents the memory node.

Create a RABBITMQ cluster in a single-machine environment in Windows

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.