Enabling the Livy /ha-status endpoint
The /ha-status endpoint reports whether a Livy server is the leader
of its service instance. HAProxy uses it as a health check, so that requests go to the leader
instead of to a passive server that answers with an HTTP 307 redirect.
When the endpoint is enabled, GET /ha-status returns the following
responses:
| Livy server state | HTTP status | Response body |
|---|---|---|
| Leader | 200 |
{"status":"leader"} |
| Passive (follower) | 503 |
{"status":"follower"} |
The endpoint is disabled by default. Livy exposes it only when high availability recovery
is active, that is, when livy.server.recovery.mode is
ha. Cloudera Manager sets this mode when a Livy service
has more than one Livy Server role. If you enable the endpoint while the recovery mode is
not ha, Livy logs a warning and does not expose the endpoint.
The endpoint does not require authentication, so that load balancers can probe it without Kerberos credentials. It returns only the leader or follower state of the server.
