As I am totally new for DGraph …can you suggest me which steps should I follow to run DGraph on a single machine but in distributed mode? I mean I want to create 2-3 nodes so that I can distribute my partitioned data.
If it is not possible to run on single machine then please suggest some steps to install on different machine and run in distributed mode.
You can run a multi-instance Dgraph cluster on a single machine.
When running on the host you’ll need to use seperate ports and directory paths.
You can also use Docker to run a multi-instance cluster https://github.com/dgraph-io/dgraph/tree/master/contrib/config/docker. You can update Zero’s
--replicas flag to 1 if you only want sharded data and no replicas.
Where should I find --replicas flag?
I mean, is this syntax for command prompt?
You can see the flag configuration when running
dgraph zero --help.
It’s also mentioned in this doc: https://docs.dgraph.io/deploy/#understanding-dgraph-cluster
Okay so in multi -instance DGraph how many Ratel-UI screen I can use.? I mean for each instance I have to set different alpha ports and by using which I can use Ratel-Ui console. So is there any constraint on number of ratel-ui console?
You can use a single Ratel instance and switch the Alpha addresses in the UI. You can use any number of Ratel clients to connect to a cluster.
Okay… But If I want to make one node as a coordinator …from where I can run query and other nodes will answer…Is it possible on single machine multi-instance Dgraph?
I’m not exactly sure what you’re asking. If you want to connect to a single endpoint to be able to query data across the entire cluster, you can do that by connecting to a single Alpha which will internally query for data across other Alphas if a predicate belongs to them based on the sharding.
Yes, That is what I want to do. So for that, If I create 3 alpha instances…and run query on one of the alpha it will automatically answer by connecting other alphas…right…? And for which I have to create replicas of zero…or will it work for only one zero?
It doesn’t matter if the Zero group is one or an HA config.
To create multi-instance DGraph how to create multiple alphas with different ports?
I mean if I create one alpha with
dgraph alpha --lru_mb 2048 zero localhost:5080
Then how to create another alpha…? Because here we are passing only localhost and port of zero
My setup (two groups, with a group having 3 node each). Only single zero though:
version: "3.3" volumes: zero: alpha_1: alpha_2: alpha_3: alpha_4: alpha_5: alpha_6: networks: dgraph: ipam: config: - subnet: 172.28.0.0/16 services: zero: container_name: zero image: dgraph/dgraph:latest volumes: - zero:/dgraph networks: dgraph: ipv4_address: 172.28.1.100 deploy: placement: constraints: - node.hostname == aws01 command: dgraph zero --my=zero:5080 --replicas 3 alpha_1: container_name: alpha_1 image: dgraph/dgraph:latest hostname: "alpha_1" volumes: - alpha_1:/dgraph networks: dgraph: ipv4_address: 172.28.1.1 deploy: placement: constraints: - node.hostname == aws01 command: dgraph alpha --my=alpha_1:7080 --lru_mb=2048 --zero=zero:5080 alpha_2: container_name: alpha_2 image: dgraph/dgraph:latest hostname: "alpha_2" volumes: - alpha_2:/dgraph networks: dgraph: ipv4_address: 172.28.1.2 deploy: replicas: 1 placement: constraints: - node.hostname == aws02 command: dgraph alpha --my=alpha_2:7081 --lru_mb=2048 --zero=zero:5080 -o 1 alpha_3: container_name: alpha_3 image: dgraph/dgraph:latest hostname: "alpha_3" volumes: - alpha_3:/dgraph networks: dgraph: ipv4_address: 172.28.1.3 deploy: replicas: 1 placement: constraints: - node.hostname == aws03 command: dgraph alpha --my=alpha_3:7082 --lru_mb=2048 --zero=zero:5080 -o 2 alpha_4: container_name: alpha_4 image: dgraph/dgraph:latest hostname: "alpha_4" volumes: - alpha_4:/dgraph networks: dgraph: ipv4_address: 172.28.1.4 deploy: placement: constraints: - node.hostname == aws04 command: dgraph alpha --my=alpha_4:7083 --lru_mb=2048 --zero=zero:5080 -o 3 alpha_5: container_name: alpha_5 image: dgraph/dgraph:latest hostname: "alpha_5" volumes: - alpha_5:/dgraph networks: dgraph: ipv4_address: 172.28.1.5 deploy: replicas: 1 placement: constraints: - node.hostname == aws05 command: dgraph alpha --my=alpha_5:7084 --lru_mb=2048 --zero=zero:5080 -o 4 alpha_6: container_name: alpha_6 image: dgraph/dgraph:latest hostname: "alpha_6" volumes: - alpha_6:/dgraph networks: dgraph: ipv4_address: 172.28.1.6 deploy: replicas: 1 placement: constraints: - node.hostname == aws06 command: dgraph alpha --my=alpha_6:7085 --lru_mb=2048 --zero=zero:5080 -o 5 ratel: container_name: ratel image: dgraph/dgraph:latest hostname: "ratel" ports: - 8000:8000 networks: dgraph: ipv4_address: 172.28.1.101 command: dgraph-ratel
Then add this into your
172.28.1.1 alpha_1 172.28.1.2 alpha_2 172.28.1.3 alpha_3 172.28.1.4 alpha_4 172.28.1.5 alpha_5 172.28.1.6 alpha_6 172.28.1.100 zero 172.28.1.101 ratel
But then in ratel how to connect with different alphas?
And if I don’t want to create replicas of zero then will it work fine?
This does work fine on two my machines. Should work for you too.
Thanks a ton!
I will try this.
Is this your IP address? or mask?
This is configuration of my pc. Can you please help me with these, to set hosts name?
This defines IP address for a host (alpha_1, alpha_2, etc). The network is set in
docker-compose up -d
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.