Reputation: 117
I'm facing a problem with aerospike.
I have two nodes cluster having IP 192.168.1.2
and 192.168.1.3
My aerospike nodejs client is configured with 192.168.1.2
but when i restart this node. then my client is unable to connect with cluster.
question 1: should i add multipal IPs on client?
question 2: if i need to add multipal IPs what happen when i will add another node into the cluster? I have to edit my client configuration?
question 3: assume i add 3rd node which ip is : 192.168.1.4
. What is the steps or to add this node into this cluster? I need to edit every existing node configuration file and add mesh-seed-address-port 192.168.1.4 3002
?
Note: My aerospike is configured with default configuration. I just added mesh-seed-address-port 192.168.1.2 3002
& mesh-seed-address-port 192.168.1.3 3002
on each node.
Upvotes: 3
Views: 268
Reputation: 7117
You can provide both IP addresses. When one node is down the client will timeout on connecting to it, and try the other IP address. It only needs one successful connection to 'seed' the cluster (meaning it learns about the other nodes and partition table at that point), so it stops after the first that works.
var config = {
hosts: [
{ addr: '192.168.1.2', port: 3000 },
{ addr: '192.168.1.3', port: 3000 }
]
}
For bigger cluster people usually set up a nameserver (such as BIND) and serve up one of the IPs using round-robin. That allows you to put the hostname as the address, which is a cleaner approach. A nameserver allows you to add and drop node IPs with a delay without being too worried.
As for (3) you can provide several mesh-seed-address-port lines, so that if one is not available you can still have a node added to the cluster. Look at Mesh (Unicast) Heartbeat for more information. The new node needs to be in mode mesh
and have an explicit IP address
. If you don't have to use mesh, it's better to use multicast for heartbeats.
Upvotes: 3