Three-Node Cluster — Bare Metal¶
One node is a working install; it is not a GSLB. This guide builds a real three-node cluster: three Linux VMs, in the regions you want to answer queries from, sharing one replicated configuration.
Every step here was run end to end on three clean Ubuntu 24.04 VMs before being written down, including the failure tests at the end.
What you are building¶
| Node | Role | Mesh IP | DNS public? |
|---|---|---|---|
| node-1 | datastore bootstrap | 10.100.0.1 | Yes |
| node-2 | datastore peer | 10.100.0.2 | Yes |
| node-3 | datastore peer | 10.100.0.3 | Yes |
Each node runs the same two services — gslbd and its local rqlited — and
serves DNS independently. Point your domain's NS records at all three.
Configuration lives in rqlite, a Raft-replicated datastore co-located with
each daemon. Create a pool on any node and it appears on all of them. That
replication is what makes this a cluster, so most of this guide is about getting
those three rqlited processes to form one Raft group.
Raft needs a majority to accept writes, which is why three is the smallest sensible cluster: it survives losing one node. Two nodes survive losing none.
Prerequisites¶
- Three VMs with public IPs, any systemd Linux (Ubuntu 24.04 tested), 2 GB RAM
- Root access, and UDP+TCP 53 reachable on each
- UDP 51820 reachable between them, for the mesh
Phase 1 — Private mesh¶
Raft replication and the datastore's HTTP API must not be exposed to the internet. Put them on a WireGuard mesh. This also covers the case where nodes are in different providers or regions, where no shared private network exists.
Install WireGuard and generate a keypair on each node:
apt-get install -y wireguard
umask 077
wg genkey > /etc/wireguard/private.key
wg pubkey < /etc/wireguard/private.key > /etc/wireguard/public.key
cat /etc/wireguard/public.key # note this down for each node
Then write /etc/wireguard/wg0.conf on each node, listing the other two as
peers. On node-1 (10.100.0.1):
[Interface]
Address = 10.100.0.1/24
ListenPort = 51820
PrivateKey = <node-1 private key>
[Peer]
PublicKey = <node-2 public key>
AllowedIPs = 10.100.0.2/32
Endpoint = <node-2 public IP>:51820
PersistentKeepalive = 25
[Peer]
PublicKey = <node-3 public key>
AllowedIPs = 10.100.0.3/32
Endpoint = <node-3 public IP>:51820
PersistentKeepalive = 25
node-2 and node-3 are the same with their own address and the other two as
peers. A node behind NAT simply omits its Endpoint from its peers' configs and
relies on PersistentKeepalive to hold the path open outbound.
Bring it up on every node, then prove it:
chmod 600 /etc/wireguard/wg0.conf
systemctl enable --now wg-quick@wg0
# from node-1
ping -c2 10.100.0.2 && ping -c2 10.100.0.3
wg show wg0 # every peer should show a recent handshake
Do not continue until all three can reach each other over 10.100.0.x.
Phase 2 — Install on all three nodes¶
The same one-liner as a single-node install, run on each node:
This installs gslbd, gslbctl, rqlited, the WebUI and both systemd units,
and frees port 53 from systemd-resolved. See
Installation for the detail.
Do not start anything yet — the datastore has to be clustered first.
Phase 3 — Cluster the datastore¶
This is the step that turns three installs into one cluster. Skip it and you get three isolated nodes that each answer DNS from their own private database: a pool created on one is invisible on the others.
Each node's rqlited must bind to its mesh address, not localhost, so peers
can reach it.
node-1 — bootstrap¶
The first node starts a cluster alone. Write /etc/gslb/rqlited.env:
systemctl restart rqlited
curl -s http://10.100.0.1:4001/status | grep -o '"state":"[A-Za-z]*"'
# "state":"Leader"
Wait for Leader before joining anything to it.
node-2 and node-3 — join¶
Same file, own addresses, plus a join target:
RQLITE_NODE_ID=node-2
RQLITE_HTTP_ADDR=10.100.0.2:4001
RQLITE_RAFT_ADDR=10.100.0.2:4002
RQLITE_EXTRA_FLAGS=-join 10.100.0.1:4002
Two things bite people here:
-jointakes the peer's Raft address — barehost:4002. Not anhttp://URL, and not the HTTP port 4001. rqlite v8+ rejects both, with an error about the address "serving HTTP when it should be Raft".- A joining node wipes its own data and adopts the leader's. Bootstrap the node holding the configuration you want to keep, and join the others to it.
Restart each in turn, then confirm from any node:
All three should be "reachable": true and "voter": true, with exactly one
"leader": true. If a node is unreachable, it is almost always the firewall —
4001 and 4002 must be open both ways across the mesh. ICMP succeeding is not
sufficient; the Raft TCP port has to be open or the leader loses quorum.
Phase 4 — Point each daemon at its datastore¶
The shipped config assumes a single node and connects to localhost:4001. Now
that rqlited binds the mesh address, each gslbd must follow it.
In /etc/gslb/config.yaml on each node, set rqlite.httpAddr to that
node's own mesh address, and uncomment the cluster: / node: blocks (they
ship commented, under "CLUSTER IDENTITY") to give the node an identity:
rqlite:
httpAddr: 10.100.0.1:4001 # this node's mesh address
cluster:
id: "production" # same on every node
node:
id: "node-1" # unique per node
Set dns.domain to the zone you are serving while you are in there. Then start
the daemons:
gslbd.service declares Requires=rqlited.service, so starting gslbd starts
the datastore with it.
Phase 5 — Firewall¶
Public on every node:
| Port | Protocol | Why |
|---|---|---|
| 53 | UDP + TCP | DNS |
| 51820 | UDP | WireGuard |
Mesh only — never public:
| Port | Protocol | Why |
|---|---|---|
| 4001 | TCP | rqlite HTTP API |
| 4002 | TCP | rqlite Raft |
| 8080 | TCP | REST API + WebUI |
| 9090 | TCP | Prometheus metrics |
With ufw active:
ufw allow 53
ufw allow 51820/udp
ufw allow from 10.100.0.0/24 to any port 4001 proto tcp
ufw allow from 10.100.0.0/24 to any port 4002 proto tcp
The API binds 127.0.0.1 by default. Reach the WebUI over an SSH tunnel
(ssh -L 8080:localhost:8080 root@node-1, then http://localhost:8080/ui/), or
put it behind TLS before binding it publicly — it carries session cookies and
API keys.
Phase 6 — Verify it is actually a cluster¶
Every node answers DNS¶
Three identical SOA records means three nodes serving one zone.
Configuration replicates¶
This is the test that proves Phase 3 worked. Create something on one node:
# on node-1
curl -s -X POST http://127.0.0.1:8080/api/v1/pools \
-H 'Content-Type: application/json' \
-d '{"name":"replication-test","algorithm":"round-robin"}'
Then read it back on another:
The same pool, with the same id, must appear. If node-3 shows an empty list,
its rqlited never joined — go back to Phase 3 and check /nodes.
It survives losing a node¶
# on the current leader
systemctl stop rqlited
# from another node, ~10s later
curl -s http://10.100.0.2:4001/status | grep -o '"state":"[A-Za-z]*"'
A surviving node takes over as Leader, and writes keep working on the
remaining two. Bring the stopped node back with
systemctl start rqlited && systemctl start gslbd; it rejoins as a follower and
catches up on everything it missed.
Expect the stopped node to go dark for DNS. gslbd has
Requires=rqlited.service, so stopping the datastore stops the daemon on that
node too — it does not keep serving from cache. That is deliberate: a node that
cannot see cluster configuration should stop answering rather than answer with
a stale view. Plan for it by pointing your NS records at all three nodes, so
resolvers fail over to the others.
Optional — shared health state via NATS¶
Without any extra setup, each node runs its own health checks and decides independently. That works, and it is the right default when nodes are spread out and each should check its nearest backends.
Add a NATS cluster on the mesh if you want nodes to share health results,
heartbeats and RTT samples — required for the global-* health policies and for
cluster-wide latency routing. Configure it under state.nats on every node:
state:
nats:
servers:
- "nats://10.100.0.1:4222"
- "nats://10.100.0.2:4222"
- "nats://10.100.0.3:4222"
healthPolicy: "prefer-local"
NATS carries ephemeral state only — health transitions, heartbeats, RTTs and
sessions, all TTL'd. Configuration never travels over it; that is rqlite's job.
Leaving state.nats.servers empty disables it cleanly.
| Policy | Behaviour |
|---|---|
prefer-local |
Uses the local checker; global results are informational |
local-only |
Ignores NATS entirely; each node decides alone |
global-any-healthy |
Healthy if the local node or any active node says so |
global-quorum |
Healthy if ≥ quorumMinPercent of active nodes agree |
Upgrading¶
Re-run the installer on each node, one at a time, confirming the node rejoins before moving on:
curl -fsSL https://gslb.nexus/install.sh | sudo bash
systemctl restart gslbd
curl -s http://10.100.0.1:4001/nodes | python3 -m json.tool # all three reachable?
Your configuration, licence and datastore survive an upgrade. Rolling one node at a time keeps a quorum, so the cluster stays writable throughout.
Uninstall¶
On each node:
systemctl disable --now gslbd rqlited
rm -f /etc/systemd/system/{gslbd,rqlited}.service
systemctl daemon-reload
rm -f /usr/local/bin/{gslbd,gslbctl,rqlited,rqlite}
rm -rf /opt/gslb /etc/gslb /var/lib/gslbd
userdel gslbd
# and the mesh, if it was only for this
systemctl disable --now wg-quick@wg0 && rm -rf /etc/wireguard
/var/lib/gslbd holds this node's copy of the cluster configuration. Back it up
first if you might want it (see docs/ops/Runbook.md).
Not covered here¶
| Topic | Where |
|---|---|
| Geo-IP routing | docs/reference/FilterChains.md |
| DNSSEC | docs/user/SecurityGuide.md |
| Delegating a real domain | Your registrar — NS records at all three node IPs |
| Kubernetes | docs/user/Kubernetes.md |
| Prometheus + Grafana | docs/user/MetricsObservability.md |
| Backup and restore | docs/ops/Runbook.md |