worker 上报的地址不正确
wojiushixiaobai opened this issue · comments
cat worker.conf
# worker 配置文件
[manager]
api_base = "http://172.16.20.11:14242"
token = ""
ca_cert = ""
[server]
hostname = "localhost"
listen_addr = "172.16.20.12"
listen_port = 16010
ssl_cert = ""
ssl_key = ""
# 检查端口
ss -tunlp | grep 16010
tcp LISTEN 0 128 172.16.20.12:16010 *:* users:(("tunasync",pid=485,fd=6))
# 通过 api 查看 workers
curl http://172.16.20.11:14242/workers
[
{
"id": "mirrors_worker",
"url": "http://localhost:16010/", # <----- 实际应该为 http://172.16.20.12:16010/
"token": "REDACTED",
"last_online": "2021-12-14T01:00:01.024609959+08:00",
"last_register": "2021-12-14T00:59:45.471653815+08:00"
}
]
# 导致下发 cmd 时 manager 没法访问到 worker
tunasynctl reload -w mirrors_worker docker -m 172.16.20.11
Failed to correctly send command: HTTP status code is not 200: {
"error":"post command to worker mirrors_worker(http://localhost:16010/) fail:
Post http://localhost:16010/: dial tcp [::1]:16010: connect: connection refused
"
}
emmmm. 突然看到一个
hostname = "localhost"
我试试修改成 ip 看看
应该是这个问题。
worker 的配置文件中,[server]
小节的 hostname
项表示 manager 该通过何种域名连接本 worker。就您的配置场景而言,此处应该为 worker 的 IP 地址。