Hello,
I have deployed an InfluxDB Docker container and I am looking for a way to check when it is ready to accept new connections, so that linked containers can start properly.
E.g., in MySQL one could use mysqladmin status for that, in PostgreSQL there is pg_isready. Is there anything similar for InfluxDB?
One way to do this would be to curl the /ping endpoint, which is a simple way to check that the server is up and listening. For example:
$ curl -sL -I localhost:8086/ping
HTTP/1.1 204 No Content
Request-Id: 3b3d966a-7d90-11e5-aad9-000000000000
X-Influxdb-Version: 0.9.4.1
Date: Wed, 28 Oct 2015 16:23:32 GMT
Success is marked by the 204 No Content return value.
As a result of https://github.com/influxdb/influxdb/pull/4600/files you can now make requests like this:
curl -sL -I localhost:8086/ping?wait_for_leader=30s
This will either a) only return when the cluster has a leader, thereby ensuring the system is ready, or b) 30 seconds (in this example) passes, which means 503 will be returned.
Hi,
sorry to dig up this old thread, but just setting up InfluxDB on a GCP instance behind a load balancer made me wonder: did nobody ever do this (properly), or did people just resort to using a TCP-only health check? As per the documentation (https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-http), GCP requires that for an HTTP health check the health endpoint must return a status 200, so 204 is in fact treated as unhealthy.
It would hence be nice if the ping endpoint could be augmented to allow the clients to specifically ask for a 200, not 204 response.
Most helpful comment
One way to do this would be to
curlthe/pingendpoint, which is a simple way to check that the server is up and listening. For example:Success is marked by the
204 No Contentreturn value.