【问题标题】:Getting error connection refused when trying to consul connect using sidecar proxy to web尝试使用边车代理连接到网络时出现错误连接被拒绝
【发布时间】:2020-07-26 13:34:29
【问题描述】:

我正在关注这个教程https://learn.hashicorp.com/consul/getting-started/connect

当我运行 consul connect proxy -sidecar-for web 时,它开始抛出这个错误:

2020-07-26T14:30:18.243+0100 [ERROR] proxy.inbound: failed to dial: error="dial tcp 127.0.0.1:0: connect: can't assign requested address"

为什么在他的演示中没有分配端口?

{
  "service": {
    "name": "web",
    "connect": {
      "sidecar_service": {
        "proxy": {
          "upstreams": [
            {
              "destination_name": "socat",
              "local_bind_port": 9191
            }
          ]
        }
      }
    }
  }
}

【问题讨论】:

    标签: proxy consul sidecar


    【解决方案1】:

    教程中的视频显示第四行为:

    "port": 8080,
    

    文档缺少该行。这并不重要,因为没有任何东西在监听 Web 服务,所以错误会持续存在。你可以放心地忽略它。我怀疑您的问题是nc 127.0.0.1 9191 操作失败。我在下面解决这个问题。

    完整的配置应该如下所示:

    {
      "service": {
        "name": "web",
        "port": 8080,
        "connect": {
          "sidecar_service": {
            "proxy": {
              "upstreams": [
                {
                  "destination_name": "socat",
                  "local_bind_port": 9191
                }
              ]
            }
          }
        }
      }
    }   
    

    但是,这对于完成实验室的这一部分并不重要。说明不清楚但不要忘记重启网络代理consul connect proxy -sidecar-for web并启动socat代理consul connect proxy -sidecar-for socat 说明和视频中严重缺少最后一部分。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-24
    相关资源
    最近更新 更多