P. Str
P. Str

Reputation: 670

Cannot cluster two AWS instances that belong to the same AWS autoscaling group using the rabbitmq-autocluster plugin

I face a problem while trying to cluster two nodes that belong to the same autoscaling group. Note that everything worked perfectly when I tried to cluster them manually.

I have two AWS instances (Centos7) within the same AWS autoscaling group and each instance has RabbitMQ 3.6.10 with Erlang/OTP 20 installed. I also installed and enabled the rabbitmq-autocluster plugin 0.8.0 (https://github.com/rabbitmq/rabbitmq-autocluster)

Here's the rabbitmq.config file in both instances:

[
 {rabbit, [
    {autocluster_log_level, info}
 ]},
 {autocluster, [
    {backend, aws},
    {aws_autoscaling, true},
    {aws_ec2_region, "eu-west-1"},
    {aws_access_key, "my_access_key"},
    {aws_secret_key, "my_secret_access_key"}
 ]}
].

I start the first RMQ server in the first instance (rabbit@ip-172-31-20-113). It creates its own single-node cluster as expected.

BUT, when I start the RMQ server in the second instance (rabbit@ip-172-31-16-139) it does not get clustered with the first instance although it recognizes that both of them belong to the same autoscaling group. Here's the rabbitmq log from the second RMQ server (rabbit@ip-172-31-16-139):

=INFO REPORT==== 28-Sep-2017::08:32:30 ===
autocluster: List of registered nodes retrieved from the backend: 
['rabbit@ip-172-31-20-113', 'rabbit@ip-172-31-16-139'] -----> As you 
can see autocluster plugin retrieved the nodes from the scaling group.

=ERROR REPORT==== 28-Sep-2017::08:32:30 ===
autocluster: No nodes to choose the preferred from!

=INFO REPORT==== 28-Sep-2017::08:32:30 ===
autocluster: Picked node as the preferred choice for joining: 
undefined

=INFO REPORT==== 28-Sep-2017::08:32:30 ===
autocluster: Running step maybe_cluster

=INFO REPORT==== 28-Sep-2017::08:32:30 ===
autocluster: We are the first node in the cluster, starting up 
unconditionally.

Why doesn't the 2nd instance choose to enter the 1st instance cluster?

I would appreciate any help!

Upvotes: 3

Views: 273

Answers (1)

P. Str
P. Str

Reputation: 670

Problem solved once I used the same .erlang cookie in both nodes. I know that this is mandatory for all nodes to have the same .erlang cookie to enter a cluster. It is documented in the manual setup of a rabbitmq-cluster. So I guess that this is also prerequisite in order for rabbitmq-autocluster plugin to cluster the nodes.

Upvotes: 2

Related Questions