Connection to multiple nodes


I tried the following code;

var db = new couchbase.Connection({
host: ["<host1>:8091","<host2>:8091"]

Now, if I shut down host1, than I get a connection. If I shut down host2, than the connection fails.

BTW: The following works:

var db = new couchbase.Connection({
host: ["<host1>:8091","<host2>:<some wrong port>"]

So, if one host in the list is not reachable than I get a connection failure.

Am I doing something wrong?

Are both hosts a part of the same cluster and are they the only two in that cluster?

1 Answer

« Back to question.

There are only two machines in the cluster.

I worked around the problem. The nodeJS process runs on the same machine as Couchbase. So I connect simply to localhost on each host. This works fine to me.

Still, the behavior looks like a bug to me.