Couchnode connection to cluster

#1

Hi,

I use couchnode to connect to a couchbase cluster

the cluster is scaled to add or remove servers depending on the charge , is it necessary to update the list of server each time we change the list or the client can it by itself?

let s say we have 3 servers , cbase01.myproject.com cbase02.myproject.com cbase03.myproject.com

my node.js code is :

var serverList = "couchbase://cbase01.myproject.com,cbase02.myproject.com,cbase03.myproject.com"
var cluster = new couchbase.Cluster(serverList)

is it the right way to connect , or giving only one server will be ok ?

if I add cbase04 does it have to update to :

var serverList = "couchbase://cbase01.myproject.com,cbase02.myproject.com,cbase03.myproject.com,cbase04.myproject.com"
var cluster = new couchbase.Cluster(serverList)

#2

Hey @nico_ad,

The list of remote servers you provide to the SDK is used only when initially connecting. As long as you have a reasonable number of servers in your list, you will be protected from intermittent failures of any specific node from preventing your application from starting up. Other than the initial bootstrap case, adding new nodes to your cluster will be automatically determined and updating the list is unnecessary.

Cheers, Brett

#3

Thanks @brett19 for the clarification. very usefull :slightly_smiling: