Node.js client 2.0.2 how connect to multiple hosts


#1

We initialize the lib using the Cluster constructor which accepts a connection string. How can we pass multiple hosts? For example if you have hosts:

var hosts = [
  'http://host1.mycompany.com:8091/pools',
  'http://host2.mycompany.com:8091/pools',
  'http://host3.mycompany.com:8091/pools'
]

is there a way to pass this to Cluster c’tor?

Thanks


#2

after some debugging, it seems the correct connection sting would be:

'http://host1.mycompany.com:8091,host2.mycompany.com:8091,host3.mycompany.com:8091'

can anyone confirm this?


#3

Hey bojand,

This is correct, I suggest you omit the port number if you are not using non-default ports though.

Cheers, Brett