title: Connecting to Zookeeper in a Apache Kafka Multi Node cluster
body: <p>I followed the following instructions to set up a multi node kafka cluster.
  Now, how to connect to the zookeeper ? Is it okay to connect to just one zookeeper from the Producer/consumer side in JAVA or is there a way to connect all the zookeeper nodes ? </p>
  
  <p>Setting a multi node Apache ZooKeeper cluster</p>
  
  <p>On every node of the cluster add the following lines to the file kafka/config/zookeeper.properties</p>
  
  <pre><code>    server.1=zNode01:2888:3888
      server.2=zNode02:2888:3888
      server.3=zNode03:2888:3888
      #add here more servers if you want
      initLimit=5
      syncLimit=2
  </code></pre>
  
  <p>On every node of the cluster create a file called myid in the folder represented by the dataDir property (by default the folder is /tmp/zookeeper ). The myid file should only contains the id of the znode (‘1’ for zNode01, ‘2’ for ZNode02, etc… )</p>
  
  <p>Setting  a multi broker Apache Kafka cluster</p>
  
  <p>On every node of the cluster modify modify the property zookeeper.connect from the file  kafka/config/server.properties:</p>
  
  <pre><code>    zookeeper.connect=zNode01:2181,zNode02:2181,zNode03:2181
  </code></pre>
  
  <p>On every node of the cluster modify the property host.name from the file kafka/config/server.properties:
          host.name=zNode0x</p>
  
  <p>On every node of the cluster modify the property broker.id from the file kafka/config/server.properties (every broker in the cluster should have a unique id)</p>