Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consul watch not working with unix socket for http #2385

Closed
hcstestacc opened this issue Oct 3, 2016 · 4 comments · Fixed by #2730
Closed

consul watch not working with unix socket for http #2385

hcstestacc opened this issue Oct 3, 2016 · 4 comments · Fixed by #2730
Labels
type/bug Feature does not function as expected
Milestone

Comments

@hcstestacc
Copy link

hcstestacc commented Oct 3, 2016

Server: 0.7.0

Operating system and Environment details

Ubuntu 14.04

Description of the Issue (and unexpected/desired result)

I run consul server listening on unix sockets for http and rpc. I can demonstrate reliable connectivity to them using the cli for rpc and nc for http over the sockets. When I added a watch to my consul server though, I now get the following in my logs:

2016/10/03 23:01:48 consul.watch: Watch (type: keyprefix) errored: Get http://%2Fvar%2Frun%2Fconsul%2Fconsul_http.sock/v1/kv/cfg?recurse=: dial tcp: lookup /var/run/consul/consul_http.sock: invalid domain name, retry in 20s

For some reason, even though http/rpc addresses are being set to unix:///var/run/consul/consul_<http/rpc>.sock - the watch is trying to dial in to an http address.

Reproduction steps

Run consul with a config like:

{
  "addresses": {
    "http": "unix:///var/run/consul/consul_http.sock",
    "rpc": "unix:///var/run/consul/consul_rpc.sock"
  },
  "bind_addr": "10.0.0.29",
  "bootstrap": true,
  "datacenter": "mydc",
  "data_dir": "/opt/consul/data",
  "log_level": "INFO",
  "server": true,
  "watches": [
    {
      "type": "keyprefix",
      "prefix": "cfg",
      "handler": "/opt/consul/myhndl.sh"
    }
   ]
}

Watch the logs try to make the watch connect via tcp instead of over unix socket.

Is there something I'm missing in the config for my watch?

@tomalok
Copy link

tomalok commented Oct 6, 2016

I think I've just encountered something similar... But in my case, I've disabled http (set the port to -1)

    "ports": {
         "http": -1,
         "https": 8500
    },

I'm able to consul watch -type nodes watch-handler-script just fine (I've exported CONSUL_HTTP_SSL='1') but when I try to put watches into the config, I'm getting

2016/10/06 00:15:44 consul.watch: Watch (type: nodes) errored: Get https://0.0.0.0:-1/v1/catalog/nodes: dial tcp: invalid port -1, retry in 2m5s

It'd be nice if it could just use HTTPS and I could keep HTTP turned off -- though a unix socket would be even better...

@hcstestacc
Copy link
Author

Oh yes, I also had the same behaviour when I exported CONSUL_HTTP_ADDR=unix:///var/run/consul/consul_http.sock too :(

@tomalok
Copy link

tomalok commented Oct 6, 2016

Trying "http": 8499 (had to completely restart consul, reload wasn't good enough)...

2016/10/06 00:42:55 consul.watch: Watch (type: nodes) errored: Get https://0.0.0.0:8499/v1/catalog/nodes: http: server gave HTTP response to HTTPS client, retry in 5s

So, now it's trying to talk HTTPS to the HTTP port...

@tomalok
Copy link

tomalok commented Oct 6, 2016

explicitly setting CONSUL_HTTP_ADDR=https://127.0.0.1:8500 didn't work either. Back to the https://0.0.0.0:-1/... error.

@slackpad slackpad added the type/bug Feature does not function as expected label Nov 30, 2016
@slackpad slackpad added this to the 0.7.4 milestone Nov 30, 2016
@slackpad slackpad modified the milestones: 0.8.0, Triaged Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Feature does not function as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants