Unable to open Consul UI or API

1.9k Views Asked by At

I have installed 2 VMs with which form a consul cluster. Via the console I can see that 1 server took leadership. I have installed the UI but when I go to http://192.168.0.80 I get "This site can't be reached, ERR_CONNECTION_REFUSED".

The config file for the 1st Consul server:

{
  "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"
  ]
}

When I try to make an API call via curl -v http://192.168.0.80:8500/v1/catalog/services I get

* 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

Is it correct that port 8500 will only listen on 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

How to change this?

Firewalld is disabled.

1

There are 1 best solutions below

1
On

You need to add "client_addr": "0.0.0.0", "ui": true in your consul config to enable client request to Consul UI