我正在尝试在我的本地设置一个 vitess 集群。我选择 zookeeper 作为我的拓扑服务器,并使用 docker-compose 进行设置。
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
这似乎工作正常,我能够将zoonaviator gui 连接到每个节点而不会出现任何错误。
之后,我正在执行以下 sh 文件来设置我的 vtcltd 并将其连接到 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
但它无法连接。在日志中它不断显示以下错误:
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
作为参考,我正在遵循这个生产指南。