aerospike / aerospike-server.docker

Dockerfiles for Aerospike Server
Other
141 stars 68 forks source link

Docker healthcheck #28

Closed dsw9742 closed 6 years ago

dsw9742 commented 6 years ago

It would be really helpful to have a high-level HEALTHCHECK command built in to the Aerospike Server Docker image.

Recognizing that there could be a lot of deployment-specific details that constitute "what is healthy?" (this 2015 forum post touches on it), I'd propose that use of the "default" HEALTHCHECK command be enabled or disabled by way of an environment variable (e.g. --env "AS_DEFAULT_HEALTHCHECK=false") passed to docker at container/service creation time. Of course, users could also overwrite the default HEALTHCHECK instruction using the flags Docker exposes.

Big question is: what would be the ideal way to determine Aerospike Server node health at a really basic level? Anything that requires use of the asinfo command then has a dependency on Aerospike Tools, which could be (or is even likely to be) a separate container in a Docker-ized environment. Alternatively, is there any way to implement this (again, at a very basic level) without Aerospike Tools?

I'm happy to give this a whirl myself via pull request if anyone can provide a little feedback on the above.

dsw9742 commented 6 years ago

Seeing Aerospike Tools is included in the latest Dockerfile. Maybe that is the way to go. Could be something as simple as HEALTHCHECK CMD /opt/aerospike/bin/asinfo -h localhost -p 3000 -v status

volmarl commented 6 years ago

Thanks for your suggestion on the healhcheck. The status command could be used to determine if the server is listening on port 3000. This could also be done with other tcp port test tools to check port 3000. A more thorough health check would require checking additional metrics. As mentioned in the article this link is a good start:

https://www.aerospike.com/docs/operations/monitor/key_metrics

I will open an internal Jiira for us to review the healthcheck docker feature.

We have a few options using asinfo calls for some basic check:

docker exec -ti aerospike asinfo -v status
ok

docker exec -ti aerospike asinfo -v build
3.14.1.8 
yosifkit commented 6 years ago

@volmarl for the official images @tianon and I maintain, we have taken the stance that it is up to the user to define (and is usually custom for their needs). See https://github.com/docker-library/cassandra/pull/76#issuecomment-246054271 and the many issues linked there.

volmarl commented 6 years ago

Thanks for the feedback @yosifkit You have a good point on letting the user define a health check that meets their needs.