--replicas
) on Dgraph Zero. Sharding is done (typically for databases near 1
TB in size) by creating multiple Dgraph Alpha groups. Every Dgraph Alpha group
is automatically assigned a set of distinct predicates to store and serve, thus
dividing up the data.
Examples of different cluster settings:
--my
flag should be set to the address:port (the internal-gRPC port)
that’s accessible to the Dgraph Alpha (default: localhost:5080
).--raft
superflag’s idx
option should be set to a unique Raft ID within
the Dgraph Zero group (default: 1
).--wal
flag should be set to the directory path to store write-ahead-log
entries on disk (default: zw
).--bindall
flag should be set to true for machine-to-machine
communication (default: true
).--v=2
.--my
flag should be set to the address:port (the internal-gRPC port)
that’s accessible to the Dgraph Zero (default: localhost:7080
).--zero
flag should be set to the corresponding Zero address set for
Dgraph Zero’s --my
flag.--postings
flag should be set to the directory path for data storage
(default: p
).--wal
flag should be set to the directory path for write-ahead-log
entries (default: w
)--bindall
flag should be set to true for machine-to-machine
communication (default: true
).--v=2
.zero1
zero2
zero3
alpha1
alpha2
alpha3
--raft
superflag’s
idx
option) per Dgraph Zero. Dgraph will not auto-assign Raft IDs to Dgraph
Zero instances.
The first Dgraph Zero that starts will initiate the database cluster. Any
following Dgraph Zero instances must connect to the cluster via the --peer
flag to join. If the --peer
flag is omitted from the peers, then the Dgraph
Zero will create its own independent Dgraph cluster.
First Dgraph Zero example:
dgraph zero --replicas=3 --raft idx=1 --my=zero1:5080
The --my
flag must be set to the address:port of this instance that peers will
connect to. The --raft
superflag’s idx
option sets its Raft ID to 1
.
Second Dgraph Zero example:
dgraph zero --replicas=3 --raft idx=2 --my=zero2:5080 --peer=zero1:5080
The --my
flag must be set to the address:port of this instance that peers will
connect to. The --raft
superflag’s idx
option sets its Raft ID to 2, and the
--peer
flag specifies a request to connect to the Dgraph cluster of zero1
instead of initializing a new one.
Third Dgraph Zero example:
dgraph zero --replicas=3 --raft idx=3 --my=zero3:5080 --peer=zero1:5080
:
The --my
flag must be set to the address:port of this instance that peers will
connect to. The --raft
superflag’s idx
option sets its Raft ID to 3, and the
--peer
flag specifies a request to connect to the Dgraph cluster of zero1
instead of initializing a new one.
Dgraph Zero configuration options:
--my
flag should be set to the address:port (the internal-gRPC port)
that will be accessible to Dgraph Alpha (default: localhost:5080
).--raft
superflag’s idx
option should be set to a unique Raft ID within
the Dgraph Zero group (default: 1
).--wal
flag should be set to the directory path to store write-ahead-log
entries on disk (default: zw
).--bindall
flag should be set to true for machine-to-machine
communication (default: true
).--v=2
.--replicas
flag. Above, it’s set to 3. So when Dgraph Alphas join the
cluster, Dgraph Zero will assign it to an Alpha group to fill in its members up
to the limit per group set by the --replicas
flag.
First Alpha example: dgraph alpha --my=alpha1:7080 --zero=zero1:5080
Second Alpha example: dgraph alpha --my=alpha2:7080 --zero=zero1:5080
Third Alpha example: dgraph alpha --my=alpha3:7080 --zero=zero1:5080
Dgraph Alpha configuration options:
--my
flag should be set to the address:port (the internal-gRPC port)
that will be accessible to the Dgraph Zero (default: localhost:7080
).--zero
flag should be set to the corresponding Zero address set for
Dgraph Zero’s --my
flag.--postings
flag should be set to the directory path for data storage
(default: p
).--wal
flag should be set to the directory path for write-ahead-log
entries (default: w
)--bindall
flag should be set to true for machine-to-machine
communication (default: true
).--v=2
.