领事代理拨号失败:拨号 tcp 127.0.0.1:0: 连接:连接被拒绝
Consul proxy failed to dial: dial tcp 127.0.0.1:0: connect: connection refused
我正在尝试 运行 consul 连接代理,但它显示意外错误
这是我的配置
{
"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
有什么建议吗?
问题是因为服务没有端口,所以它尝试连接到 proxy.local_service_port - Defaults to the parent service port.
为父服务指定端口解决了问题
我正在尝试 运行 consul 连接代理,但它显示意外错误
这是我的配置
{
"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
有什么建议吗?
问题是因为服务没有端口,所以它尝试连接到 proxy.local_service_port - Defaults to the parent service port.
为父服务指定端口解决了问题