1

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.

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

This seems to be working fine, I am able to connect the zoonaviator gui to each of the nodes without any errors.

After that i am executing the following sh file to setup and connect my vtcltd to the zookeeper.

#!/bin/bash

VTDATAROOT="${VTDATAROOT:-${PWD}/vtdataroot}" #???

# Aliases
alias vtctlclient="command vtctlclient -server localhost:15999 -log_dir ${VTDATAROOT}/tmp -alsologtostderr"

mkdir -p vtdataroot/tmp

echo "Starting vtctld...."
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

But it is not able to connect. In the logs it keeps showing the following errors:

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

For ref, I am following this production guide.

0 Answers0