title: Which hostname to choose from a group of zookeepers
body: <p>I am new to <em>distributed system</em>, and I am using docker to set up a group of <strong>zookeeper</strong>s.</p>
  
  <p>For example, I have three <strong>zookeeper</strong>s started:</p>
  
  <pre><code>services:
    zoo1:
      image: zookeeper
      restart: always
      ports:
        - 2181
      environment:
        ZOO_MY_ID: 1
        ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
  
    zoo2:
      image: zookeeper
      restart: always
      ports:
        - 2181
      environment: 
        ZOO_MY_ID: 2
        ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
  
    zoo3:
      image: zookeeper
      restart: always
      ports:
        - 2181
      environment:
        ZOO_MY_ID: 3
        ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
  </code></pre>
  
  <p>For starting a <strong><em>kafka</em></strong>, I have to config its <code>server.properties</code>.<br>
  In the <em>zookeeper.connection=localhost:2181</em> example, what should I configure here?</p>
  
  <pre><code>zookeeper.connection=zoo1 / zoo2 / zoo3:2181?
  </code></pre>
  
  <p>or I should leave them three there? thanks</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>The <strong><em>kafka</em></strong> of course will be configured to be started within the same <code>docker-compose.yml</code> file. </p>
  
  <p>But the <code>Dockerfile</code> of <code>kafka</code> was written locally. and I think that I should modify the <code>zookeeper.connect=...</code> in <code>server.properties</code> accordingly instead of using the <code>localhost</code>.</p>