我有一项要使用 Connect 代理的服务,并按照HashiCorp Learn 门户上的说明进行操作。
这是我的“你好”服务:
{
"service": {
"name": "node",
"port": 3000,
"connect": {
"sidecar_service": {}
}
}
}
然后我做一个“领事重新加载”并创建代理
consul connect proxy -sidecar-for node &
当我创建另一个这样的服务时
consul connect proxy -service web -upstream node:9191
我可以通过调用端口 9191 (curl localhost:9191) 上的 Web 服务来验证我是否可以访问我的节点服务。但是当我在如下所示的 json 文件中定义我的 web 服务,然后注册它(使用consul reload
)并想要连接到它时,我有以下错误:
curl: (7) Failed to connect to localhost port 9191: Connection refused
web.json
{
"service": {
"name": "web",
"connect": {
"sidecar_service": {
"proxy": {
"upstreams": [
{
"destination_name": "node",
"local_bind_port": 9191
}
]
}
}
}
}
}
有什么我错过的吗?