We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
Dgraph Zero controls the Dgraph cluster, and stores information about it. It automatically moves data between different Dgraph Alpha instances based on the size of the data served by each Alpha instance.
Before you can run dgraph alpha
, you must run at least one dgraph zero
node.
You can see the options available for dgraph zero
by using the following
command:
The --replicas
option controls the replication factor: the number of replicas
per data shard, including the original shard. For consensus, the replication
factor must be set to an odd number, and the following error occurs if it’s set
to an even number (for example, 2
):
When a new Alpha joins the cluster, it’s assigned to a group based on the
replication factor. If the replication factor is set to 1
, then each Alpha
node serves a different group. If the replication factor is set to 3
and you
then launch six Alpha nodes, the first three Alpha nodes serve group 1 and next
three nodes serve group 2. Zero monitors the space occupied by predicates in
each group and moves predicates between groups as-needed to re-balance the
cluster.
Like Alpha, Zero also exposes HTTP on port 6080 (plus any ports specified by
--port_offset
). You can query this port using a GET request to access the
following endpoints:
/state
returns information about the nodes that are part of the cluster.
This includes information about the size of predicates and which groups they
belong to./assign?what=uids&num=100
allocates a range of UIDs specified by the num
argument, and returns a JSON map containing the startId
and endId
that
defines the range of UIDs (inclusive). This UID range can be safely assigned
externally to new nodes during data ingestion./assign?what=timestamps&num=100
requests timestamps from Zero. This is
useful to “fast forward” the state of the Zero node when starting from a
postings directory that already has commits higher than Zero’s leased
timestamp./removeNode?id=3&group=2
removes a dead Zero or Alpha node. When a replica
node goes offline and can’t be recovered, you can remove it and add a new node
to the quorum. To remove dead Zero nodes, pass group=0
and the id of the
Zero node to this endpoint.Before using the API ensure that the node is down and ensure that it doesn’t
come back up ever again. Don’t use the same idx
of a node that was removed
earlier.
/moveTablet?tablet=name&group=2
Moves a tablet to a group. Zero already
re-balances shards every 8 minutes, but this endpoint can be used to force
move a tablet.You can also use the following POST endpoint on HTTP port 6080:
/enterpriseLicense
applies an enterprise license to the cluster by supplying
it as part of the body.The /state
endpoint of Dgraph Zero returns a JSON document of the current
group membership info, which includes the following:
Here’s an example of JSON for a cluster with three Alpha nodes and three Zero
nodes returned from the /state
endpoint:
This JSON provides information that includes the following, with node members shown with their node name and HTTP port number:
maxUID
maxUID
+1. Any UIDs lost between
these leases is never used for blank-node UID assignment./assign?what=uids&num=1000
to
reserve a range of UIDs (in this case, 1000) to use externally. Zero never
use these UIDs for blank node UID assignment, so the user can use the range
to assign UIDs manually to their own data sets.maxTxnTs
maxTxnTs
+1 .
Any lost transaction IDs between these leases is never used./assign?what=timestamps&num=1000
to increase the current transaction
timestamp (in this case, by 1000). This is mainly useful in special-case
scenarios; for example, using an existing -p directory
to create a fresh
cluster to be able to query the latest data in the DB.maxRaftId
CID
maxNodes
: unlimitedThe terms tablet, predicate, and edge are currently synonymous in this context. In future, Dgraph might improve data scalability to shard a predicate into separate tablets that can be assigned to different groups.
We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.
Dgraph Zero controls the Dgraph cluster, and stores information about it. It automatically moves data between different Dgraph Alpha instances based on the size of the data served by each Alpha instance.
Before you can run dgraph alpha
, you must run at least one dgraph zero
node.
You can see the options available for dgraph zero
by using the following
command:
The --replicas
option controls the replication factor: the number of replicas
per data shard, including the original shard. For consensus, the replication
factor must be set to an odd number, and the following error occurs if it’s set
to an even number (for example, 2
):
When a new Alpha joins the cluster, it’s assigned to a group based on the
replication factor. If the replication factor is set to 1
, then each Alpha
node serves a different group. If the replication factor is set to 3
and you
then launch six Alpha nodes, the first three Alpha nodes serve group 1 and next
three nodes serve group 2. Zero monitors the space occupied by predicates in
each group and moves predicates between groups as-needed to re-balance the
cluster.
Like Alpha, Zero also exposes HTTP on port 6080 (plus any ports specified by
--port_offset
). You can query this port using a GET request to access the
following endpoints:
/state
returns information about the nodes that are part of the cluster.
This includes information about the size of predicates and which groups they
belong to./assign?what=uids&num=100
allocates a range of UIDs specified by the num
argument, and returns a JSON map containing the startId
and endId
that
defines the range of UIDs (inclusive). This UID range can be safely assigned
externally to new nodes during data ingestion./assign?what=timestamps&num=100
requests timestamps from Zero. This is
useful to “fast forward” the state of the Zero node when starting from a
postings directory that already has commits higher than Zero’s leased
timestamp./removeNode?id=3&group=2
removes a dead Zero or Alpha node. When a replica
node goes offline and can’t be recovered, you can remove it and add a new node
to the quorum. To remove dead Zero nodes, pass group=0
and the id of the
Zero node to this endpoint.Before using the API ensure that the node is down and ensure that it doesn’t
come back up ever again. Don’t use the same idx
of a node that was removed
earlier.
/moveTablet?tablet=name&group=2
Moves a tablet to a group. Zero already
re-balances shards every 8 minutes, but this endpoint can be used to force
move a tablet.You can also use the following POST endpoint on HTTP port 6080:
/enterpriseLicense
applies an enterprise license to the cluster by supplying
it as part of the body.The /state
endpoint of Dgraph Zero returns a JSON document of the current
group membership info, which includes the following:
Here’s an example of JSON for a cluster with three Alpha nodes and three Zero
nodes returned from the /state
endpoint:
This JSON provides information that includes the following, with node members shown with their node name and HTTP port number:
maxUID
maxUID
+1. Any UIDs lost between
these leases is never used for blank-node UID assignment./assign?what=uids&num=1000
to
reserve a range of UIDs (in this case, 1000) to use externally. Zero never
use these UIDs for blank node UID assignment, so the user can use the range
to assign UIDs manually to their own data sets.maxTxnTs
maxTxnTs
+1 .
Any lost transaction IDs between these leases is never used./assign?what=timestamps&num=1000
to increase the current transaction
timestamp (in this case, by 1000). This is mainly useful in special-case
scenarios; for example, using an existing -p directory
to create a fresh
cluster to be able to query the latest data in the DB.maxRaftId
CID
maxNodes
: unlimitedThe terms tablet, predicate, and edge are currently synonymous in this context. In future, Dgraph might improve data scalability to shard a predicate into separate tablets that can be assigned to different groups.