无法打开Consul UI或API

时间:2017-01-01 18:08:33

标签: api centos consul

我已经安装了2个VM,形成了一个consul集群。通过控制台,我可以看到1台服务器领先。我已安装了用户界面,但当我转到http://192.168.0.80时,我得到了#34;无法访问此网站,ERR_CONNECTION_REFUSED"。

第一个Consul服务器的配置文件:

{
  "datacenter": "azure",
  "data_dir": "/tmp/consul",
  "log_level": "DEBUG",
  "node_name": "consul01",
  "server": true,
  "bootstrap_expect": 2,
  "ui_dir": "/opt/consul-ui",
  "bind_addr": "192.168.0.80",
  "leave_on_terminate": true,
  "start_join": [
   "192.168.0.80",
   "192.168.0.81"
  ]
}

当我尝试通过curl -v http://192.168.0.80:8500/v1/catalog/services进行API调用时,我得到了

* About to connect() to 192.168.0.80 port 8500 (#0)
*   Trying 192.168.0.80...
* Connection refused
* Failed connect to 192.168.0.80:8500; Connection refused
* Closing connection 0
curl: (7) Failed connect to 192.168.0.80:8500; Connection refused

端口8500只能侦听localhost是否正确?

# netstat -atn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.0.81:8300       0.0.0.0:*               LISTEN
tcp        0      0 192.168.0.81:8301       0.0.0.0:*               LISTEN
tcp        0      0 192.168.0.81:8302       0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8400          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8500          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8600          0.0.0.0:*               LISTEN

如何更改?

Firewalld已停用。

1 个答案:

答案 0 :(得分:0)

您需要添加 "client_addr": "0.0.0.0", "ui": true  在您的consul配置中启用客户请求Consul UI