如何克服领事中的问题 500(后端响应错误)?

How to overcome issue 500 (The backend responded with an error) in consul?

嗨,我的 macbook,我使用的是 consul 版本 1.8.0

并使用此配置启动 (consul agent -config-file desky.json):

{
 "node_name": "desky.local",
 "ui": true,
 "retry_join": ["172.20.20.31"],
 "advertise_addr": "172.20.20.1",
 "data_dir": "/tmp/consul"
}

我知道这里报告了这个问题,但似乎人们仍然有问题并且没有回复它已修复。 https://github.com/hashicorp/consul/issues/7288

在我 运行 consul agent 的 macbook 命令行中,我在启动时收到以下日志,其中有一些错误。

 2020-08-31T18:04:17.048+0100 [INFO]  agent: Retry join is supported for the following discovery methods: cluster=LAN discovery_methods="aliyun aws azure digitalocean gce k8s linode mdns os packet scaleway softlayer tencentcloud triton vsphere"
    2020-08-31T18:04:17.048+0100 [INFO]  agent: Joining cluster...: cluster=LAN
    2020-08-31T18:04:17.048+0100 [INFO]  agent: started state syncer
==> Consul agent running!
    2020-08-31T18:04:17.048+0100 [INFO]  agent: (LAN) joining: lan_addresses=[172.20.20.31]
    2020-08-31T18:04:17.048+0100 [WARN]  agent.client.manager: No servers available
    2020-08-31T18:04:17.048+0100 [ERROR] agent.anti_entropy: failed to sync remote state: error="No known Consul servers"
    2020-08-31T18:04:17.051+0100 [INFO]  agent.client.serf.lan: serf: EventMemberJoin: consul-server 172.20.20.31
    2020-08-31T18:04:17.051+0100 [INFO]  agent.client: adding server: server="consul-server (Addr: tcp/172.20.20.31:8300) (DC: dc1)"
    2020-08-31T18:04:17.051+0100 [INFO]  agent: (LAN) joined: number_of_nodes=1
    2020-08-31T18:04:17.051+0100 [INFO]  agent: Join cluster completed. Synced with initial agents: cluster=LAN num_agents=1
    2020-08-31T18:04:18.584+0100 [ERROR] agent.client: RPC failed to server: method=Catalog.NodeServiceList server=172.20.20.31:8300 error="rpc error making call: rpc: can't find method Catalog.NodeServiceList"
    2020-08-31T18:04:18.591+0100 [INFO]  agent: Synced node info
    2020-08-31T18:04:19.476+0100 [INFO]  agent: Newer Consul version available: new_version=1.8.3 current_version=1.8.0

好吧,Hashicorp 应该在抛出错误时将其作为一个可能的例子来解决,

我在 consul 服务器端使用了这个:

-bind 0.0.0.0
-client 0.0.0.0

解决了这个问题。