RABBITMQ cluster configuration under Windows environment

Source: Internet
Author: User
Tags rabbitmq

First, install the Erlang environment on the cluster machine, install the RABBITMQ;

Second, assume that the 192.168.10.111 node name is [email protected],192.168.10.112 node name is [email protected]

1. Create the cluster configuration file rabbitmq.config on the RabbitMQ data of the two machines and the path of the log files (this document is C:\Users\Administrator\AppData\Roaming\RabbitMQ).

Rabbitmq.config is a standard Erlang configuration file. It must conform to the standards of the Erlang profile.

It has both a default directory and can be configured in the rabbitmq-env.conf file.

The content is (including the last.):

[{rabbit,[{cluster_nodes, [' [E-mail protected] ', ' [email protected] '}]}].

2. Configure the host (C:\Windows\System32\drivers\etc directory) of the two machines separately.

111:

192.168.10.111 h1-pc

192.168.10.112 h2-pc

112:

192.168.10.112 h2-pc

192.168.10.111 h1-pc

3. The RabbitMQ data of two machines and the path of log files (this document is C:\Users\Administrator\AppData\Roaming\RabbitMQ), Create a configuration file rabbitmq-env.conf for the RABBITMQ environment variable.

192.168.10.111 's rabbitmq-env.conf content is:

[Email protected]

node_ip_address=192.168.10.111

node_port=5672

Rabbitmq_mnesia_base=c:\users\administrator\appdata\roaming\rabbitmq\db

Rabbitmq_log_base=c:\users\administrator\appdata\roaming\rabbitmq\log

192.168.10.112 's rabbitmq-env.conf content is:

[Email protected]

node_ip_address=192.168.10.112

node_port=5672

Rabbitmq_mnesia_base=c:\users\administrator\appdata\roaming\rabbitmq\db

Rabbitmq_log_base=c:\users\administrator\appdata\roaming\rabbitmq\log

4. Replace the. erlang.cookie file under the C:\Users\Administrator folder of 192.168.10.111.

192.168.10.112 C:\Users\Administrator and C:\Windows the file (which is the authentication key that the cluster node communicates with, all nodes must be the same.) In turn).

5. Restart the rabbitmq of the two machines.

(1) 192.168.10.112, execute the following statements separately under the console D:\RabbitMQ server\rabbitmq_server-2.8.1\sbin path:

Rabbitmqctl Stop_app

Rabbitmqctl Reset

Rabbitmqctl Start_app

(2) 192.168.10.111, execute the following statements separately under the console D:\RabbitMQServer\rabbitmq_server-2.8.1\sbin path:

Rabbitmqctl Stop_app

Rabbitmqctl Reset

Rabbtimqctl join_cluster [email protected]

Rabbitmqctl Start_app

The above command stops the RABBITMQ application, resets the cluster state, then calls the cluster command, connects the h1-pc to the h2-pc, makes both a cluster, and finally restarts the RABBITMQ application. Under this cluster command, H1-PC is a memory node, H2-PC is a disk node (after RABBITMQ startup, the default is the disk node).

If you want the H1-PC to be a disk node in the cluster, change the 3rd sentence as follows:

RABBITMQCTL cluster [email protected] [email protected]

As long as you include yourself in the node list, it becomes a disk node. In a RABBITMQ cluster, at least one disk node must exist.

6. On h1-pc and H2-PC, run the Rabbitmqctl cluster_status command to view the cluster status.

Cluster Status of node ' [email protected] ' ...

[{nodes,[{disc,[' [email protected] ']},{ram,[' [email protected] '}]},

{running_nodes,[' [email protected] ', ' [email protected] '}]

... done.

RABBITMQ cluster configuration under Windows environment

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.