title: Vitess vtctl cannot connect to zookeeper topo server
body: <p>I am trying to setup a vitess cluster on my local. I chose zookeeper as my topology server and I have used docker-compose to set it up.</p>
  <pre><code>version: '3.9'
  services:
  
    zoo1:
      container_name: zks1
      image: zookeeper
      restart: always
      hostname: zoo1
      ports:
        - '2181:2181'
      environment:
        - ALLOW_ANONYMOUS_LOGIN=yes
        - ZOO_MY_ID = 1
        - ZOO_SERVERS = server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
  
    zoo2:
      container_name: zks2
      image: zookeeper
      restart: always
      hostname: zoo2
      ports:
        - '2182:2181'
      environment:
        - ALLOW_ANONYMOUS_LOGIN=yes
        - ZOO_MY_ID = 2
        - ZOO_SERVERS = server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
  
    zoo3:
      container_name: zks3
      image: zookeeper
      restart: always
      hostname: zoo3
      ports:
        - '2183:2181'
      environment:
        - ALLOW_ANONYMOUS_LOGIN=yes
        - ZOO_MY_ID = 3
        - ZOO_SERVERS = server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
  
    zoonavigator:
      container_name: zoonavigator
      image: elkozmon/zoonavigator
      ports:
        - 9000:9000
  </code></pre>
  <p>This seems to be working fine, I am able to connect the <a href="https://github.com/elkozmon/zoonavigator" rel="nofollow noreferrer">zoonaviator</a> gui to each of the nodes without any errors.</p>
  <p>After that i am executing the following sh file to setup and connect my vtcltd to the zookeeper.</p>
  <pre><code>#!/bin/bash
  
  VTDATAROOT=&quot;${VTDATAROOT:-${PWD}/vtdataroot}&quot; #???
  
  # Aliases
  alias vtctlclient=&quot;command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr&quot;
  
  mkdir -p vtdataroot/tmp
  
  echo &quot;Starting vtctld....&quot;
  vtctld \
    -topo_implementation zk2 \
    -topo_global_server_address 'localhost:21811,localhost:21812,localhost:21813' \
    -topo_global_root /vitess/global \
    -log_dir=${VTDATAROOT}/tmp \
    -port=15000 \
    -grpc_port=15999 \
    -service_map='grpc-vtctl' \
    -pid_file $VTDATAROOT/tmp/vtctld.pid \
  
  
  vtctlclient AddCellInfo \
    -root /vitess/cell1 \
    -server_address 'localhost:21811,localhost:21812,localhost:21813' \
    cell1
  </code></pre>
  <p>But it is not able to connect. In the logs it keeps showing the following errors:</p>
  <pre><code>I0204 15:13:19.797639   71234 logutil.go:31] log: Failed to connect to [::1]:21813: dial tcp [::1]:21813: connect: connection refused
  I0204 15:13:23.057163   71234 logutil.go:31] log: Failed to connect to [::1]:21812: dial tcp [::1]:21812: connect: connection refused
  I0204 15:13:26.305079   71234 logutil.go:31] log: Failed to connect to [::1]:21811: dial tcp [::1]:21811: connect: connection refused
  
  </code></pre>
  <p>For ref, I am following <a href="https://vitess.io/docs/13.0/user-guides/configuration-basic/global-topo/" rel="nofollow noreferrer">this</a> production guide.</p>