16

How does the connection string given to CuratorFrameworkFactory#newClient look like? So far I haven't found any information on the web and the JavaDoc doesn't tell me the correct format.

Just a student
  • 10,560
  • 2
  • 41
  • 69
Ztyx
  • 14,100
  • 15
  • 78
  • 114

2 Answers2

20

According to this post, it is of the format

IP1:PORT1,IP2:PORT2,...,IPn:PORTn

. For example:

127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183,127.0.0.1:2184
Community
  • 1
  • 1
Ztyx
  • 14,100
  • 15
  • 78
  • 114
  • 10
    One of the worst instances of "everything is documented, but the documentation tells you nothing" I've seen in a public API. I kept following the source through various builder methods and eventually until I got to FixedEnsembleProvider and gave up, no dice. It's just "the connection string" in every Javadoc all the way down. – mpontes Jun 03 '16 at 12:06
3

Curator is an API client for Apache Zookeeper so the full documented answer to this is available in the Zookeeper Javadocs: Zookeeper Javadocs

connectString - comma separated host:port pairs, each corresponding to a zk server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" If the optional chroot suffix is used the example would look like: "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a" where the client would be rooted at "/app/a" and all paths would be relative to this root - ie getting/setting/etc... "/foo/bar"

Trastle
  • 5,155
  • 6
  • 26
  • 20