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.
A learner node instance can forward
/admin
operations and perform both read
and write operations, but writing will incur in network call latency to the
main cluster.Set up a Learner node
The learner node feature works at the Dgraph Alpha group level. To use it, first you need to set up an Alpha instance as a learner node. Once the learner instance is up, this replica can be used to run best-effort queries with zero latency overhead. Because itâs an Enterprise feature, a learner node wonât be able to connect to a Dgraph Zero node until the Zero node has a valid license. To spin up a learner node, first make sure that you start all the nodes, including the Dgraph Zero leader and the Dgraph Alpha leader, with the--my
flag so that these nodes will be accessible to the learner node. Then, start an
Alpha instance as follows:
You must specify the
--my
flag to set the IP address and port of Dgraph
Zero, the Dgraph Alpha leader node, and the learner node. If you donât, you
will get an error similar to the following: Error during SubscribeForUpdates
Best-effort Queries
Regular queries use the strict consistency model, and any write operation to the cluster anywhere would be read immediately. Best-effort queries apply the eventual consistency model. A write to the cluster will be seen eventually to the node. In regular conditions, the eventual consistency is usually achieved quickly. A best-effort query to a learner node returns any data that is already available in that learner node. The response is still a valid data snapshot, but at a timestamp which is not the latest one.Best-effort queries wonât be forwarded to a Zero node to get the latest
timestamp.
If the learner node needs to serve normal queries, at least one Alpha leader
must be available.