Search code examples
redhatiptablessubnetaerospikeaerospike-loader

How to create two Aerospike Clusters on same L2 network


I am using two aerospike clusters(each with one node/machine only).

Since both machine are on same LAN, they try to connect each other trying to form single cluster. Because of this I was getting error(while inserting record):

Error: (11) AEROSPIKE_ERR_CLUSTER

So on my ubuntu setup(one of two machines) I blocked port 9918 using cmd:

ufw block 9918

After block cmd, aerospike clusters started working(I was able to insert record).

Whats better way to avoid two Aerospike machines on same LAN to not communicate with each other ?


Solution

  • Just make sure to change the multicast address and/or port in the heartbeat configuration so the 2 nodes don't try to send heartbeat to each other.

    heartbeat { mode multicast # Send heartbeats using Multicast address 239.1.99.2 # multicast address port 9918 # multicast port interval 150 # Number of milliseconds between heartbeats timeout 10 # Number of heartbeat intervals to wait # before timing out a node }

    Alternatively, you can also switch to mode mesh and have only the node itself in the mesh-see-address-port list:

    heartbeat { mode mesh # Send heartbeats using Mesh (Unicast) protocol port 3002 # port on which this node is listening to # heartbeat mesh-seed-address-port 192.168.1.100 3002 # IP address for seed node in the cluster # This IP happens to be the local node interval 150 # Number of milliseconds between heartbeats timeout 10 # Number of heartbeat intervals to wait before # timing out a node }