Setup for load balancing over 2 servers

I have two servers with equal amounts of memory and disk space. I want to replicate Dgraph over these two servers to manage load. I saw the example compose file that uses 3 servers. Would 2 servers work (with consensus and all). setting --replicas=2 and have one zero on the manager node and 1 alpha on the manager and 1 alpha on the worker. Is this possible?

--replicas must be set to an odd number (1, 3, or 5). This is a Raft replication group, so an odd number is required for a proper quorum. https://dgraph.io/docs/deploy/ports-usage/#ha-cluster-setup

2 Likes

So for two servers I would set --replicas=3?

A high-available set up is a 6-node Dgraph cluster (3 Zeros, 3 Alpha replicas.

You can set --replicas=3 and run two Alphas, in which case the two Alphas would be replicated. But 2 Alphas is not a high available set up. If one of the Alphas stopped, then there’s no longer majority consensus in the replication group, and txns will not run without a majority of the cluster being up.

And, for your question about running 1 Zero and 1 Alpha on one node and the other Alpha on another node, that’s OK. Each Alpha should be on a different node so they’re not sharing machine resources.

1 Like

Ok so it’s only useful if a minimum of 3 servers are available. I guess I can try it with 2 for now I want to offload some of the memory consumption to the second server. So I can do --replicas=3 on the zero, have the zero and 1 alpha on the manager node, and the one alpha on the worker node. Technically that should work right? just wouldn’t be HA.

Yup.