我正在尝试运行领事连接代理,但显示意外错误
这是我的配置
{
"service": {
"name": "api",
"check": {
"name": "HTTP 80",
"http": "http://localhost:80",
"interval": "10s",
"timeout": "10s"
},
"connect": {
"sidecar_service": {
"proxy":{
"upstreams":[{
"destination_name": "elasticsearch",
"local_bind_port": 9200
}]
}
}
}
}
}
这是带有日志记录的命令 $ consul connect proxy -sidecar-for elasticsearch ==> Consul Connect代理开始... 配置方式:代理API ID的Sidecar:elasticsearch 代理ID:elasticsearch-sidecar-proxy
==> Log data will now stream in as it occurs:
2019/06/03 08:00:54 [INFO] Proxy loaded config and ready to serve
2019/06/03 08:00:54 [INFO] TLS Identity: spiffe://fadce594-37c1-8586-1b57-c6245436684c.consul/ns/default/dc/dc1/svc/elasticsearch
2019/06/03 08:00:54 [INFO] TLS Roots : [Consul CA 8]
2019/06/03 08:00:54 [INFO] public listener starting on 0.0.0.0:21000
2019/06/03 08:01:02 [ERR] failed to dial: dial tcp 127.0.0.1:0: connect: connection refused
^C==> Consul Connect proxy shutdown
有什么建议吗?
答案 0 :(得分:0)
问题是因为该服务没有端口,所以它试图连接到proxy.local_service_port - Defaults to the parent service port.
指定父服务的端口即可解决问题