Set up dgraph cluster manually


(Salohy Miarisoa) #1

Hy Dgraph community,

We want to set up a cluster manually. We have 6 centOS machines and want 3 zero with 6 alpha.

We have following questions:

How can we add replicas?
How can we add peers?
How can we connect alpha and zero

For now we have following configurations according to this post https://computingforgeeks.com/install-dgraph-on-centos-ubuntu/

Configuration for zero:

cat <<EOF | sudo tee /etc/systemd/system/dgraph.service
[Unit]
Description=dgraph.io data server
Wants=network.target
After=network.target dgraph-zero.service
Requires=dgraph-zero.service

[Service]
Type=simple
ExecStart=/usr/local/bin/dgraph alpha --lru_mb 2048 -p /var/run/dgraph/p -w /var/run/dgraph/w
StandardOutput=journal
StandardError=journal
User=dgraph
Group=dgraph

[Install]
WantedBy=multi-user.target

Configuration for alpha

[Unit]
Description=dgraph.io zero server
Wants=network.target
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/dgraph zero --wal /var/run/dgraph/zw
StandardOutput=journal
StandardError=journal
User=dgraph
Group=dgraph

[Install]
WantedBy=multi-user.target
RequiredBy=dgraph.service
EOF

Unfortunately we got this error main process exited, code=exited, status=2/INVALIDARGUMENT

Thank you in advance :slight_smile:


Problem is setting up multinode cluster
(Salohy Miarisoa) #2

Hey all,

Me again, we got the cluster running by using following configs:

Zero

ExecStart=/usr/local/bin/dgraph zero -o 2 --my=this-vm-ip:5080 --peer zero-leader-ip:5080  --idx 3  --wal /var/run/dgraph/zw

Alpha

ExecStart=/usr/local/bin/dgraph alpha --my=this-vm-ip:7080 --lru_mb=2048 --zero=zero-leader-ip:5080 -o 2  -p /var/run/dgraph/p -w /var/run/dgraph/w

All Alpha are connecting fine to each other but unfortunately we are getting Read index context timed out in Zero.


(Michel Conrado) #3

Each Dgraph instance needs a configuration in accordance with parameters like -o flag. As you add -0 2 you need to put all ports +2 offset. eg:

dgraph zero -o 2 --my=this-vm-ip:5082 --peer zero-leader-ip:508?  --idx 3 
dgraph alpha --my=this-vm-ip:7082 --lru_mb=2048 --zero=zero-leader-ip:508? -o 2 

https://docs.dgraph.io/deploy/#cluster-checklist

BTW, you can’t choose who the leader is. This is decided via algorithm.


(Salohy Miarisoa) #4

Thank you very much for your answer, what do you mean with zero-leader-ip:508? , what should we put on the ?


(Michel Conrado) #5

508 “?” means the offset of any Zero instance. Or in the case of Zero peer, should be the first instance.


(Salohy Miarisoa) #7

One more question @MichelDiz … How should the graph.service look like if we want just to set up alpha on a node without the zero?

we have this error

May 02 04:48:02 vm-2 dgraph[7792]: W0502 04:48:02.210807    7792 pool.go:212] Connection lost with vm-2:7084. Error: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp vm-2:7084: connect: connection refused"

Thanks in advance :slight_smile:


(Michel Conrado) #8

Do you mean a HA config? in fact you need zero, zero is like a “balancer” for data and also a uid provider. It manages the cluster itself. There’s no way to Dgraph work without them.


(Mohana Bhattacharya) #9

@MichelDiz
I keep on getting the error when setting up alpha nodes
Error: rpc error: code = Unavailable desc = all SubConns are in TransientFailure,…ection refused
And ratel doesnt work with schema alteration
Refer - Problem is setting up multinode cluster

Can you help me in knowing what i am doing wrong here.

Thanks