【问题标题】:Dial tcp 127.0.0.1:8500: getsockopt: connection refused in consul拨打 tcp 127.0.0.1:8500:getsockopt:consul 中的连接被拒绝
【发布时间】:2017-09-29 13:06:16
【问题描述】:

当我在领事服务器和客户端上运行任何 "consul members" 时,我收到此错误。端口处于 LISTENING 状态,我确保没有防火墙阻止。在领事客户端中运行相同时出现此错误:

检索成员时出错:获取http://127.0.0.1:8500/v1/agent/members:
dial tcp 127.0.0.1:8500: connectex: 无法建立连接 因为目标机器主动拒绝了。

当我使用私有 IP 发出上述请求时,我得到了所需的输出。我可以在任何地方更改配置,以便它在专用 IP 上侦听请求吗?

【问题讨论】:

    标签: tcp consul getsockopt


    【解决方案1】:

    您的consul members 似乎缺少-http-addr=... 选项。

    示例

    consul members -http-addr=10.10.10.10:8500

    假设您使用 consul 代理的标准端口 8500 并且您通过以下方式启动 consul:

    consul agent -client=10.10.10.10 #...

    在哪里可以找到文档?

    • Running an Agent: "Client Addr" 下的 Consul 文档中:

      如果您更改此地址或端口,则必须在运行 consul members 等命令时指定 -http-addr 以指示如何访问代理。

    • 或通过consul members -help离线:

      http-addr=<address> Theaddressand port of the Consul HTTP agent. The value can be an IP address or DNS address, but it must also include the port. This can also be specified via the CONSUL_HTTP_ADDR environment variable. The default value is http://127.0.0.1:8500. The scheme can also be set to HTTPS by setting the environment variable CONSUL_HTTP_SSL=true.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-21
      • 2019-12-12
      • 2018-12-26
      • 1970-01-01
      • 2019-12-25
      • 1970-01-01
      • 2020-11-22
      • 2020-12-31
      相关资源
      最近更新 更多