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

Connect to InfluxDB via a Unix Domain Socket #3366

Closed
binary0111 opened this issue Oct 20, 2017 · 8 comments · Fixed by #3942
Closed

Connect to InfluxDB via a Unix Domain Socket #3366

binary0111 opened this issue Oct 20, 2017 · 8 comments · Fixed by #3942
Assignees
Labels
area/influxdb feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@binary0111
Copy link

binary0111 commented Oct 20, 2017

Feature Request

Proposal:

Add support for connecting to InfluxDB over a unix domain socket

Current behavior:

We can connect to InfluxDB via UDP or HTTP(S) over TCP but not UDS. While Telegraf has support for a generic socket writer which supports UDS, InfluxDB's UDS socket listener expects HTTP.

See : influxdata/influxdb#7135
influxdata/kapacitor#1628

Desired behavior:

Be able to talk to InfluxDB on the same host via UDS.

Use case:

  1. Improved security
  2. Reduce TCP overhead for hosts running the TICK stack on the same box and have limited resources
@adityacs
Copy link
Contributor

adityacs commented Nov 1, 2017

@danielnelson Can we implement the same way as explained here influxdata/influxdb#7135 ?

@danielnelson
Copy link
Contributor

Yeah, probably just need to add a unix_socket = "/var/run/influxdb.sock" option that if set enabled the dial function.

@binary0111
Copy link
Author

@danielnelson how about something like urls = ["uds:///var/run/influxdb.sock"] ? Also what will be the implication for https (including self signed certs)? I guess https is not really necessary over uds given correct permissions on the socket.

@danielnelson
Copy link
Contributor

That config style works for me. You won't be able to add a path but it will work better with multiple servers which is more important. Certificates should work the same, you can use them if you want but there is not much of a point.

@binary0111
Copy link
Author

Yeah true. However right now you can specify a certificate but opt to not use it for certain connections by specifying http vs https. I suppose with uds there are two ways to do it - 1) always try to use https if a certificate has been configured or 2) a config option use_https_with_unix_socket = True.

@danielnelson
Copy link
Contributor

We might need the option, since even with no cert options set we might need to do a https connection. One thing to check is if InfluxDB can even use https on the unix-socket.

What if when the unix_socket option is set we use the socket for all localhost urls, then you could have https for remote and http or https for localhost. The unix_socket format is inspired by curl which looks like this: curl --unix-socket /var/run/docker.sock http://localhost/write.

If we did this we would lose the ability to connect to both a tcp socket and unix socket on localhost in the same output.

If we decide to use the socket path I think we should use "unix" as the scheme too: urls = ["unix:///var/run/influxdb.sock"].

@danielnelson danielnelson added this to the 1.6.0 milestone Dec 14, 2017
@danielnelson danielnelson self-assigned this Feb 1, 2018
@danielnelson danielnelson added feature request Requests for new plugin and for new features to existing plugins area/influxdb labels Mar 20, 2018
@danielnelson
Copy link
Contributor

The ["unix:///var/run/influxdb.sock"] variation was added.

@binary0111
Copy link
Author

Thanks @danielnelson ! Much appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/influxdb feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants