Documentation ¶
Overview ¶
Package health implements Elasticsearch healthchecks (using https://github.com/heptiolabs/healthcheck) to check the liveness and readiness of an Elasticsearch node.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultHTTPTimeout = 30 * time.Second
DefaultHTTPTimeout is the default timeout for sending HTTP requests to Elasticsearch.
Functions ¶
func CheckLiveHEAD ¶
func CheckLiveHEAD(URL string) healthcheck.Check
CheckLiveHEAD checks if a HEAD request to / returns 200.
func CheckReadyJoinedCluster ¶
func CheckReadyJoinedCluster(url string) healthcheck.Check
CheckReadyJoinedCluster checks if a Elasticsearch node has joined a cluster.
func CheckReadyRollingUpgrade ¶
func CheckReadyRollingUpgrade(url string) healthcheck.Check
CheckReadyRollingUpgrade checks that Elasticsearch has recovered from a rolling upgrade.
The purpose of this check is to prevent the rolling upgrade from proceeding. Most deployment systems have some concept of a healthcheck grace period where a failing health check is ignored for some period of time during startup. The rolling upgrade usually won't proceed until the healthcheck starts passing.
The check fails for one of two reasons:
- Index shards on this node are in the INITIALIZING state. Only shards that are present when the check first runs are considered in future runs. That way any newly created indices/shards in the INITIALIZING state won't interrupt node startup. (Really, you should try not to write to Elasticsearch when doing an upgrade.)
- Any shard in the cluster is in a RELOCATING state. The rolling upgrade should not proceed while shards are being moved around due to the danger of data loss.
After the check passes for the first time, it will always pass on every subsequent call.
See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/rolling-upgrades.html
Types ¶
This section is empty.