gpt4 book ai didi

tcp - 调用 tcp 127.0.0.1 :8500: getsockopt: connection refused in consul

转载 作者:可可西里 更新时间:2023-11-01 02:30:49 27 4
gpt4 key购买 nike

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

Error retrieving members: Get http://127.0.0.1:8500/v1/agent/members:
dial tcp 127.0.0.1:8500: connectex: No connection could be made because the target machine actively refused it.

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

最佳答案

看来你的consul members缺少选项 -http-addr=... .

示例

consul members -http-addr=10.10.10.10:8500

假设您使用标准端口 8500领事代理人,你通过以下方式开始领事:

consul agent -client=10.10.10.10 #...

在哪里可以找到文档?

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

    If you change this address or port, you'll have to specify a -http-addr whenever you run commands such as consul members to indicate how to reach the agent.

  • 或通过 consul members -help 离线:

    http-addr=<address>
    The
    addressand 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.

关于tcp - 调用 tcp 127.0.0.1 :8500: getsockopt: connection refused in consul,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43730582/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com