What I want to do
Setup cluster of DGraph in Ubuntu20.04 with 3 Alpha and 3 Zero
What I did
Steps to run as daemon:
- dpkg --print-architecture
- mkdir dgraph, cd dgraph
- wget https://github.com/dgraph-io/dgraph/releases/download/v23.1.0/dgraph-linux-amd64.tar.gz
- tar -xvzf dgraph-linux-amd64.tar.gz
- create file for daemon: vi /etc/systemd/system/dgraph.service
[Unit]
Description=dgraph.io data server
Wants=network.target
After=network.target dgraph.service
Requires=dgraph.service
[Service]
Type=simple
ExecStart=/home/sre/dgraph/dgraph alpha --my=VM_IP:7080 --zero=VM_IP:5080 --raft=idx=2 -p /var/run/dgraph/p -w /var/run/dgraph/w
StandardOutput=journal
StandardError=journal
User=root
Group=root
[Install]
WantedBy=multi-user.target
- mkdir -p /var/run/dgraph/zw, chmod -R 750 /var/run/dgraph
- ls -ld /var/run/dgraph, ls -ld /var/run/dgraph/zw/
- sudo systemctl daemon-reload, systemctl status dgraph, systemctl restart dgraph
Post changing the above configuration for different VM’s:
Able to run the DGraph with 3 Alpha and 3 Zero Nodes as Daemon Service in Ubuntu20.04
Zero 1:
ExecStart=/home/sre/dgraph/dgraph zero --my=VM_IP_1:5080 --replicas 3 --raft=idx=1 --wal /var/run/dgraph/zw
Zero 2:
ExecStart=/home/sre/dgraph/dgraph zero --my=VM_IP_2:5080 --peer VM_IP_1:5080 --replicas 3 --raft=idx=2 --wal /var/run/dgraph/zw
Zero 3:
ExecStart=/home/sre/dgraph/dgraph zero --my=VM_IP_3:5080 --peer VM_IP_1:5080 --replicas 3 --raft=idx=3 --wal /var/run/dgraph/zw
Alpha 1:
ExecStart=/home/ashwani.yadav/dgraph alpha --my=VM_IP_4:7080 --zero=VM_IP_1:5080 --raft=idx=1 -p /var/run/dgraph/p -w /var/run/dgraph/w
Alpha 2:
ExecStart=/home/sre/dgraph/dgraph alpha --my=VM_IP_5:7080 --zero=VM_IP_1:5080 --raft=idx=2 -p /var/run/dgraph/p -w /var/run/dgraph/w
Alpha 3:
ExecStart=/home/sre/dgraph/dgraph alpha --my=VM_IP_6:7080 --zero=VM_IP_1:5080 --raft=idx=3 -p /var/run/dgraph/p -w /var/run/dgraph/w
Now cluster is up and running without any issue, but in the RatelUI only 1 Group is having all the tablets, none of the other Group of Alpha has any tablets, until and unless I am specifically making the schema in it.
My questions are:
Ideally Tablets should be distributed across different Alpha’s in the Group automatically, right ?
Second Issue, I am not able to get my data back. Insertion of data went fine and have given me success on the admin API response, but once I am trying to find the data using Query nothing is showing up ?
How to maintain the snapshot and how to apply snapshot in case recovery is needed ?