influxdata / influxdb-relay

Service to replicate InfluxDB data for high availability
MIT License
855 stars 350 forks source link

Support /ping endpoint #24

Closed shanab closed 8 years ago

shanab commented 8 years ago

I'm using InfluxDB Relay to forward data to 2 InfluxDB instances + 1 Kapacitor instance. Eventually I would like kapacitor to write to Relay, the only problem now is that with the following kapacitor config:

[[influxdb]]
  enabled = true
  name = "localhost"
  default = true
  urls = ["http://192.168.50.11:9096", "http://192.168.50.12:9096"]
  disable-subscriptions = true
  ...

Kapacitor tries to ping a URL before it uses it, and if the ping fails then it assumes the URL is not working and tries the next one (link to Kapacitor v0.13.1 client code). So if I'm correct, kapacitor won't be able to write to InfluxDB Relay unless:

  1. Relay supports /ping
  2. Kapacitor doesn't use ping to determine if a client is working or not

My guess would be that (1) is cleaner?

simcap commented 8 years ago

Quite useful indeed.

Recently, I kept getting some invalid write endpoint in production and was confused. My setup was going through relay to write to 2 InfluxDB instances. I had updated my components responsible to write to InfluxDB (and therefore going through relay) with a "on component startup" InfluxDB ping as a good practice.

Since relay did not accept /ping endpoint my components were getting the error invalid write endpoint comprehensibly.

Implementing the /ping to fully work would add quite a lot in the current code:

A tradeof could be that relay would answer to GET /ping by itself without contacting the backends. It would keep the same response signature

shanab commented 8 years ago

Yes that was my thought as well. If we have a /ping endpoint then something like a load balancer can easily figure out if Relay is running or not.