Skip to content

Commit e935c36

Browse files
prashant-shahidanielmai
authored andcommitted
Adding more information about /state endpoint (#4456)
* Adding more information about /state endpoint * addressing comments - removing non-empty blank lines - converting multiple paragraphs to a list * Adding /health endpoint docs (cherry picked from commit 9423d20)
1 parent 0256eaa commit e935c36

File tree

1 file changed

+153
-4
lines changed

1 file changed

+153
-4
lines changed

wiki/content/deploy/index.md

+153-4
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,24 @@ By default the Alpha listens on `localhost` for admin actions (the loopback addr
12251225
12261226
{{% notice "tip" %}}Set max file descriptors to a high value like 10000 if you are going to load a lot of data.{{% /notice %}}
12271227
1228+
### More about /health endpoint
1229+
1230+
The `/health` endpoint of Dgraph Alpha returns HTTP status 200 with a JSON consisting of basic information about the running worker.
1231+
1232+
Here’s an example of JSON returned from `/health` endpoint:
1233+
1234+
```json
1235+
{
1236+
"version": "v1.1.1",
1237+
"instance": "alpha",
1238+
"uptime": 75011100974
1239+
}
1240+
```
1241+
1242+
- `version`: Version of Dgraph running the Alpha server.
1243+
- `instance`: Name of the instance. Always set to `alpha`.
1244+
- `uptime`: Time in nanoseconds since the Alpha server is up and running.
1245+
12281246
## More about Dgraph Zero
12291247

12301248
Dgraph Zero controls the Dgraph cluster. It automatically moves data between
@@ -1242,13 +1260,13 @@ Like Alpha, Zero also exposes HTTP on 6080 (+ any `--port_offset`). You can quer
12421260
to see useful information, like the following:
12431261

12441262
* `/state` Information about the nodes that are part of the cluster. Also contains information about
1245-
size of predicates and groups they belong to.
1263+
size of predicates and groups they belong to.
12461264
* `/assign?what=uids&num=100` This would allocate `num` uids and return a JSON map
12471265
containing `startId` and `endId`, both inclusive. This id range can be safely assigned
12481266
externally to new nodes during data ingestion.
12491267
* `/assign?what=timestamps&num=100` This would request timestamps from Zero.
1250-
This is useful to fast forward Zero state when starting from a postings
1251-
directory, which already has commits higher than Zero's leased timestamp.
1268+
This is useful to fast forward Zero state when starting from a postings
1269+
directory, which already has commits higher than Zero's leased timestamp.
12521270
* `/removeNode?id=3&group=2` If a replica goes down and can't be recovered, you
12531271
can remove it and add a new node to the quorum. This endpoint can be used to
12541272
remove a dead Zero or Dgraph Alpha node. To remove dead Zero nodes, pass
@@ -1261,15 +1279,146 @@ You should not use the same `idx` of a node that was removed earlier.
12611279
{{% /notice %}}
12621280

12631281
* `/moveTablet?tablet=name&group=2` This endpoint can be used to move a tablet to a group. Zero
1264-
already does shard rebalancing every 8 mins, this endpoint can be used to force move a tablet.
1282+
already does shard rebalancing every 8 mins, this endpoint can be used to force move a tablet.
12651283

12661284

12671285
These are the **POST** endpoints available:
12681286

12691287
* `/enterpriseLicense` Use endpoint to apply an enterprise license to the cluster by supplying it
12701288
as part of the body.
12711289

1290+
### More about /state endpoint
1291+
1292+
The `/state` endpoint of Dgraph Zero returns a JSON document of the current group membership info:
12721293

1294+
- Instances which are part of the cluster.
1295+
- Number of instances in Zero group and each Alpha groups.
1296+
- Current leader of each group.
1297+
- Predicates that belong to a group.
1298+
- Estimated size in bytes of each predicate.
1299+
- Enterprise license information.
1300+
- Max Leased transaction ID.
1301+
- Max Leased UID.
1302+
- CID (Cluster ID).
1303+
1304+
Here’s an example of JSON returned from `/state` endpoint for a 6-node Dgraph cluster with three replicas:
1305+
1306+
```json
1307+
{
1308+
"counter": "15",
1309+
"groups": {
1310+
"1": {
1311+
"members": {
1312+
"1": {
1313+
"id": "1",
1314+
"groupId": 1,
1315+
"addr": "alpha1:7080",
1316+
"leader": true,
1317+
"lastUpdate": "1576112366"
1318+
},
1319+
"2": {
1320+
"id": "2",
1321+
"groupId": 1,
1322+
"addr": "alpha2:7080"
1323+
},
1324+
"3": {
1325+
"id": "3",
1326+
"groupId": 1,
1327+
"addr": "alpha3:7080"
1328+
}
1329+
},
1330+
"tablets": {
1331+
"counter.val": {
1332+
"groupId": 1,
1333+
"predicate": "counter.val"
1334+
},
1335+
"dgraph.type": {
1336+
"groupId": 1,
1337+
"predicate": "dgraph.type"
1338+
}
1339+
},
1340+
"checksum": "1021598189643258447"
1341+
}
1342+
},
1343+
"zeros": {
1344+
"1": {
1345+
"id": "1",
1346+
"addr": "zero1:5080",
1347+
"leader": true
1348+
},
1349+
"2": {
1350+
"id": "2",
1351+
"addr": "zero2:5080"
1352+
},
1353+
"3": {
1354+
"id": "3",
1355+
"addr": "zero3:5080"
1356+
}
1357+
},
1358+
"maxLeaseId": "10000",
1359+
"maxTxnTs": "10000",
1360+
"cid": "3602537a-ee49-43cb-9792-c766eea683dc",
1361+
"license": {
1362+
"maxNodes": "18446744073709551615",
1363+
"expiryTs": "1578704367",
1364+
"enabled": true
1365+
}
1366+
}
1367+
```
1368+
1369+
Here’s the information the above JSON document provides:
1370+
1371+
- Group 0
1372+
- members
1373+
- zero1:5080, id: 1, leader
1374+
- zero2:5080, id: 2
1375+
- zero3:5080, id: 3
1376+
- Group 1
1377+
- members
1378+
- alpha1:7080, id: 1, leader
1379+
- alpha2:7080, id: 2
1380+
- alpha3:7080, id: 3
1381+
- predicates
1382+
- dgraph.type
1383+
- counter.val
1384+
- Enterprise license
1385+
- Enabled
1386+
- maxNodes: unlimited
1387+
- License expires on Friday, January 10, 2020 4:59:27 PM GMT-08:00 (converted from epoch timestamp)
1388+
- Other data:
1389+
- maxTxnTs
1390+
- The current max lease of transaction timestamps used to hand out start timestamps
1391+
and commit timestamps.
1392+
- This increments in batches of 10,000 IDs. Once the max lease is reached, another
1393+
10,000 IDs are leased. In the event that the Zero leader is lost, then the new
1394+
leader starts a brand new lease from maxTxnTs+1 . Any lost transaction IDs
1395+
in-between will never be used.
1396+
- An admin can use the Zero endpoint HTTP GET `/assign?what=timestamps&num=1000` to
1397+
increase the current transaction timestamp (in this case, by 1000). This is mainly
1398+
useful in special-case scenarios, e.g., using an existing p directory to a fresh
1399+
cluster in order to be able to query the latest data in the DB.
1400+
- maxLeaseId
1401+
- The current max lease of UIDs used for blank node UID assignment.
1402+
- This increments in batches of 10,000 IDs. Once the max lease is reached, another
1403+
10,000 IDs are leased. In the event that the Zero leader is lost, the new leader
1404+
starts a brand new lease from maxLeaseId+1. Any UIDs lost in-between will never
1405+
be used for blank-node UID assignment.
1406+
- An admin can use the Zero endpoint HTTP GET `/assign?what=uids&num=1000` to
1407+
reserve a range of UIDs (in this case, 1000) to use externally (Zero will NEVER
1408+
use these UIDs for blank node UID assignment, so the user can use the range
1409+
to assign UIDs manually to their own data sets.
1410+
- CID
1411+
- This is a unique UUID representing the *cluster-ID* for this cluster. It is generated
1412+
during the initial DB startup and is retained across restarts.
1413+
- Group checksum
1414+
- This is the checksum verification of the data per Alpha group. This is used internally
1415+
to verify group memberships in the event of a tablet move.
1416+
1417+
{{% notice "note" %}}
1418+
"tablet", "predicate", and "edge" are synonymous terms today. The future plan to
1419+
improve data scalability is to shard a predicate into separate tablets that could
1420+
be assigned to different groups.
1421+
{{% /notice %}}
12731422

12741423
## TLS configuration
12751424

0 commit comments

Comments
 (0)