Node SDK connecting to a cluster connection string

When connecting to a cluster of 3 servers with the Node SDK, all of the examples just use localhost. If you are connecting to a production cluster, do you provide all of the hosts in the connection string? It seems like you would want to do that.

const cluster = new couchbase.Cluster("couchbase://localhost", {
  username: "Administrator",
  password: "password",
});

vs

const cluster = new couchbase.Cluster("server1,server2,server3", {
  username: "Administrator",
  password: "password",
});

Hello @justinbkay there is a documentation exclusively for managing connections via SDK

and you are correct (also refer to the the link above)

In a production environment, your connection string should include the addresses of multiple server nodes in case some are currently unavailable. Multiple addresses may be specified in a connection string by delimiting them with commas:

const cluster = new couchbase.Cluster(
  "couchbase://10.0.0.1,10.0.0.2,10.0.0.3"
);
1 Like