Improve load balancer docs

This commit is contained in:
Huu Nguyen 2017-02-17 15:17:50 -08:00 committed by Joao Fernandes
parent 86baab300d
commit 334a355130
1 changed files with 46 additions and 16 deletions

View File

@ -24,18 +24,27 @@ Make sure you configure your load balancer to:
* Load balance TCP traffic on ports 80 and 443 * Load balance TCP traffic on ports 80 and 443
* Not terminate HTTPS connections * Not terminate HTTPS connections
* Use the `/health` endpoint (note the lack of an `/api/v0/` in the path) on each * Use the unauthenticated `/health` endpoint (note the lack of an `/api/v0/` in
DTR replica, to check if the replica is healthy and if it should remain on the the path) on each DTR replica, to check if the replica is healthy and if it
load balancing pool or not should remain in the load balancing pool or not
## Health check endpoints ## Health check endpoints
The `/health` endpoint returns a JSON object for the replica being queried with The `/health` endpoint returns a JSON object for the replica being queried of
`"Healthy"` as one of the keys. Any response other than a 200 HTTP status code the form:
and `"Healthy":true` means the replica is unsuitable for taking requests. If
the API server is still up, the returned JSON object will have an `"Error"` key ```json
with more details. More specifically, these issues can be in any of these {
services: "Error": "error message",
"Health": true
}
```
A response of `"Healthy": true` means the replica is suitable for taking
requests. It is also sufficient to check whether the HTTP status code is 200.
An unhealthy replica will return 503 as the status code and populate `"Error"`
with more details on any one of these services:
* Storage container (registry) * Storage container (registry)
* Authorization (garant) * Authorization (garant)
@ -43,16 +52,37 @@ services:
* Content trust (notary) * Content trust (notary)
Note that this endpoint is for checking the health of a *single* replica. To get Note that this endpoint is for checking the health of a *single* replica. To get
the health of every replica in a cluster, querying each individual replica is the health of every replica in a cluster, querying each replica individiually is
the preferred way to do it in real time. the preferred way to do it in real time.
The `/api/v0/meta/cluster_status` endpoint returns a JSON object for the entire The `/api/v0/meta/cluster_status`
cluster *as observed* by the replica being queried. Health status for the [endpoint](https://docs.docker.com/datacenter/dtr/2.2/reference/api/)
replicas is available in the `"replica_health"` key. These statuses are taken returns a JSON object for the entire cluster *as observed* by the replica being
from a cache which is updated by each replica individually. queried, and it takes the form:
In addition, this endpoint returns a dump of the rethink system tables ```json
which can be rather large (~45 KB) for a status endpoint. {
"replica_health": {
"replica id": "OK",
"another replica id": "error message"
},
"replica_timestamp": {
"replica id": "2006-01-02T15:04:05Z07:00",
"another replica id": "2006-01-02T15:04:05Z07:00"
},
// other fields
}
}
```
Health statuses for the replicas is available in the `"replica_health"` object.
These statuses are taken from a cache which is last updated by each replica
individually at the time specified in the `"replica_timestamp"` object.
The response also contains information about the internal DTR storage state,
which is around 45 KB of data. This, combined with the fact that the endpoint
requires admin credentials, means it is not particularly appropriate for load
balance checks. Use `/health` instead for those kinds of checks.
## Where to go next ## Where to go next