Skip to content

Commit 334a355

Browse files
whoshuujoaofnfernandes
authored andcommitted
Improve load balancer docs
1 parent 86baab3 commit 334a355

File tree

1 file changed

+47
-17
lines changed

1 file changed

+47
-17
lines changed

datacenter/dtr/2.2/guides/admin/configure/use-a-load-balancer.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,65 @@ Make sure you configure your load balancer to:
2424

2525
* Load balance TCP traffic on ports 80 and 443
2626
* Not terminate HTTPS connections
27-
* Use the `/health` endpoint (note the lack of an `/api/v0/` in the path) on each
28-
DTR replica, to check if the replica is healthy and if it should remain on the
29-
load balancing pool or not
27+
* Use the unauthenticated `/health` endpoint (note the lack of an `/api/v0/` in
28+
the path) on each DTR replica, to check if the replica is healthy and if it
29+
should remain in the load balancing pool or not
3030

3131
## Health check endpoints
3232

33-
The `/health` endpoint returns a JSON object for the replica being queried with
34-
`"Healthy"` as one of the keys. Any response other than a 200 HTTP status code
35-
and `"Healthy":true` means the replica is unsuitable for taking requests. If
36-
the API server is still up, the returned JSON object will have an `"Error"` key
37-
with more details. More specifically, these issues can be in any of these
38-
services:
33+
The `/health` endpoint returns a JSON object for the replica being queried of
34+
the form:
35+
36+
```json
37+
{
38+
"Error": "error message",
39+
"Health": true
40+
}
41+
```
42+
43+
A response of `"Healthy": true` means the replica is suitable for taking
44+
requests. It is also sufficient to check whether the HTTP status code is 200.
45+
46+
An unhealthy replica will return 503 as the status code and populate `"Error"`
47+
with more details on any one of these services:
3948

4049
* Storage container (registry)
4150
* Authorization (garant)
4251
* Metadata persistence (rethinkdb)
4352
* Content trust (notary)
4453

4554
Note that this endpoint is for checking the health of a *single* replica. To get
46-
the health of every replica in a cluster, querying each individual replica is
55+
the health of every replica in a cluster, querying each replica individiually is
4756
the preferred way to do it in real time.
4857

49-
The `/api/v0/meta/cluster_status` endpoint returns a JSON object for the entire
50-
cluster *as observed* by the replica being queried. Health status for the
51-
replicas is available in the `"replica_health"` key. These statuses are taken
52-
from a cache which is updated by each replica individually.
53-
54-
In addition, this endpoint returns a dump of the rethink system tables
55-
which can be rather large (~45 KB) for a status endpoint.
58+
The `/api/v0/meta/cluster_status`
59+
[endpoint](https://docs.docker.com/datacenter/dtr/2.2/reference/api/)
60+
returns a JSON object for the entire cluster *as observed* by the replica being
61+
queried, and it takes the form:
62+
63+
```json
64+
{
65+
"replica_health": {
66+
"replica id": "OK",
67+
"another replica id": "error message"
68+
},
69+
"replica_timestamp": {
70+
"replica id": "2006-01-02T15:04:05Z07:00",
71+
"another replica id": "2006-01-02T15:04:05Z07:00"
72+
},
73+
// other fields
74+
}
75+
}
76+
```
77+
78+
Health statuses for the replicas is available in the `"replica_health"` object.
79+
These statuses are taken from a cache which is last updated by each replica
80+
individually at the time specified in the `"replica_timestamp"` object.
81+
82+
The response also contains information about the internal DTR storage state,
83+
which is around 45 KB of data. This, combined with the fact that the endpoint
84+
requires admin credentials, means it is not particularly appropriate for load
85+
balance checks. Use `/health` instead for those kinds of checks.
5686

5787

5888
## Where to go next

0 commit comments

Comments
 (0)