Guide

Build a cluster

Two or more nodes on one configuration. Every node answers DNS on its own, you change settings in one place, and every node's dashboard shows the whole cluster.

Why bother? Give your router's DHCP two DNS servers, and devices keep resolving while one node restarts, upgrades, or loses its SD card. DNS never depends on the cluster: a node answers the same whether its peers are up or not.

The roles

RoleWhat it does
PrimaryCreated the cluster and holds its certificate authority. Publishes the configuration and the compiled blocklists; every version is signed.
ReplicaFollows the primary and answers DNS from the last version it received, even after a restart with the primary down. Joined with an eligible token, it can be promoted to primary; with a plain token, it only follows.
WitnessA tiny vote-only process (on a NAS, router, or small VM) that lets two nodes fail over automatically. It answers no DNS and holds no data, so the dashboard and the other views that cover the cluster never ask it, or list it as a node that didn't answer. The Cluster page still shows it, as votes only: never counted as behind or not serving DNS. One that's down still fails the peers_up check and raises the node-down alert.
Resolver podOn Kubernetes with mode: scaled: joins by itself, holds no state, and can't be promoted. See Run on Kubernetes.

Create it

Run these as the user TelltaleDNS runs as: sudo -u telltale for a native install, or docker compose exec telltale with Compose.

  1. Create the cluster on the first node. List every URL other nodes might use to reach it.
    telltale cluster init --name home --advertise https://192.168.3.2:8443 --site home-pi
  2. Make a join token on it. --eligible lets the new node be promoted later; leave it out for a node that should only follow. Treat the token like a password; it's reusable until it expires.
    telltale cluster token create --ttl 1h --eligible
  3. Join from the second node. Give an eligible node its own --advertise URL, so it can be reached if it's ever promoted.
    telltale cluster join tt_join_... --site office --advertise https://192.168.3.3:8443
  4. Restart TelltaleDNS on both nodes, then check: telltale cluster status, or the web UI's Cluster page (both nodes up on Nodes; every check passing on Health).
  5. Hand out both nodes in DHCP as the first and second DNS server. Then check that devices really use the second one: a failover drill (Drill… on a node's row) silences the first for a few seconds and lists who switched and who was stuck.

The cluster port is [cluster] listen (default 0.0.0.0:8443). Only the first node's port must be reachable: joining nodes connect out to it, so they can sit behind NAT. If you also serve DoH on 8443, move one of them (telltale config check warns about the clash).

Connections on the cluster port: a connection whose certificate is a member's keeps the port's usual HTTP/2 limits. Any other connection, a node joining or asking for the CA, or a removed node, gets limits sized for a join: 2 requests at once and 2 in all (it is closed at a third), 5 s to its first request and 10 s in all, then it is closed. A join takes one request and well under a second. The port holds at most 256 connections in their TLS handshake (32 from one address) and 64 without a member certificate after it (16 from one address). When it has no room, an older connection is closed to make room for the new one: the oldest connection of the address holding the most places, whatever it has sent so far. Only when the connections that could make room are all closing already is the new one closed instead. Established member connections are never closed for that.

Trust: the token carries the fingerprint of the cluster's certificate authority, so a node can't be tricked into joining another server. The link between nodes is mutually authenticated TLS.

Joins: the first node accepts at most 30 joins a minute; a node past that is told to try again in a minute. A join's secret is checked before the join counts toward them: a join whose secret is neither a join token still valid nor the Helm chart's bootstrap secret is refused and doesn't count toward the 30. A join with a valid secret takes one of the 30 places when one is free, also when it's then refused (for example a token that can't bring what the node asks to be).

A Pi joining a Kubernetes cluster works the same way, with the token made inside the controller pod: see Run on Kubernetes.

What it shares

  • Settings: upstreams, lists, groups, devices, local names, rules, and the rest reach every node within seconds, including what was added in the web UI. Each node keeps its own listeners, API, sign-in, telemetry, and cache settings. What's shared and what isn't.
  • Change it anywhere: a change in any node's UI or API goes to the primary, which applies it for everyone. For config files, edit the primary's.
  • Blocklists: only the primary downloads and compiles them; the others fetch just the parts that changed.
  • Accounts: users and API tokens are the primary's, so the same sign-in works on every node.
  • One view: every node's dashboard, top lists, query log, and live view cover the whole cluster, and each query-log row names the node that answered. Showing on the dashboard narrows it to one node or site.

When the primary goes down

DNS keeps answering on every node either way. Only configuration changes wait until there's a primary again.

Manual failover

  1. On an eligible node, open the Cluster page and choose Promote this node…. It asks for your password again (and your authenticator code, if you use two-factor sign-in). Or stop the node, run telltale cluster promote, and start it.
  2. The node continues from the last version it applied, and every node follows it.
  3. If the old primary comes back, it steps down by itself. Anything it changed in the meantime is listed under Conflicts (Cluster → Health), so you can make those changes again.

Promotion is refused while the primary is up, so a mistake can't split the cluster.

Automatic failover

Two nodes can't tell "the other node is down" from "the link between us is down", so automatic failover needs a third vote: a witness, or a third eligible node.

# On the primary: a token for the witness
telltale cluster token create --witness

# On the witness host (a config with [node] data_dir and [cluster] listen is enough)
telltale cluster join tt_join_... --witness --advertise https://witness.lan:8443 -c witness.toml
telltale cluster witness -c witness.toml        # run it as a service

# On the primary, then restart it
telltale cluster set-failover auto
  • The primary holds a 15-second lease with a majority of voters. If it disappears, an eligible node is elected in a new epoch, typically within 15 to 25 seconds. When two nodes are free to stand at the same moment, the one whose node ID sorts first goes first and the other gives way. With three voters that means they don't split the vote, short of a lost or badly delayed message, a restart, or a disagreement over the epoch; with more voters (two witnesses, say) a split is rarer than it used to be but still possible. A split costs one more lease.
  • While the voters' lists agree, there are never two primaries writing: a primary that loses its majority stops taking changes before anyone else can be elected. Clock jumps (a Pi setting its time after boot) don't matter.
  • A voter writes a new vote to disk, and syncs the directory the file is in, before it answers it, so a power cut doesn't make it forget the vote it gave. That holds on storage that honours sync: not tmpfs, an emptyDir, or a card that acknowledges flushes it hasn't made. A voter that can't store a vote answers none: the log says can't store this node's ballot, with the step and the directory, at most once a minute. While that lasts it answers no new vote, and after a restart no renewal either; with two such voters of three the primary loses its lease and stops taking changes, while DNS keeps answering.
  • A voter whose vote record can't be read doesn't vote. If ballot.json in the cluster directory can't be read (a permission, an I/O error, a directory in its place) or isn't a vote record (damaged, cut off, empty), the voter can't tell what it voted before, so it answers no vote request (a pre-vote either) and doesn't stand itself after a restart. The log says can't read this node's vote record, with the file and the error, at most once a minute. It votes again by itself once the file reads. Fix the storage; or, only when no election is under way, remove the damaged file so the voter starts without a vote on record. DNS, and following the primary, are not affected.
  • With fewer than three voters, auto acts as manual, and the Cluster page says so. telltale cluster set-failover manual switches back.
  • A node that has joined but hasn't applied its first configuration version grants votes to the node it joined through, so the others can join and start before the first version is published. Add voters one at a time, and wait until the Cluster page shows the new node synced. Join voters through the primary: a replica that answers a join lists the new voter in its own list while the primary doesn't list it as a voter. If the primary shows no lease and changes answer 503 although the voters are connected, run telltale cluster set-failover manual on the primary, wait until the voters have a version, then set auto again.
  • A node elected, or stepping down, while its links stay open (after a drill or a maintenance handover) says so on them at once, so the node that stepped down follows the new primary and applies every change made on it.

If the cluster's configuration comes from Git, a node that isn't Git-managed can only take over as an emergency primary: see Git, for the whole cluster.

Upgrade and maintenance

  • Upgrade one node at a time: the replicas first, then the primary. Versions one cluster protocol apart work together, so a half-upgraded cluster is fine, and the Cluster page's versions check lists the mix until you're done.
  • Taking a node down for longer than a restart? Put it in maintenance first: Maintenance… on its row (Cluster → Nodes), or telltale ctl maintenance start --for 30m --reason "SD card swap". It reports not ready so load balancers move away, its alerts pause, and it keeps answering what still arrives.
  • Moving the primary back? The role doesn't return by itself, and under automatic failover a node can't be promoted by hand. Put the current primary in maintenance: it hands the role to the other eligible node. End the maintenance once that node is elected.
  • A node that was a replica and is the primary again carries on from the cluster's version, so the shared sections of its own config file aren't used: add or change entries in the UI or the API (the ones that version has are read-only there). Its log says so once.
  • A node that's gone for good? Rebuilding a machine and joining it again gives it a new ID, so the old record stays behind as a down node that still counts as a voter. Choose Remove on its row (Cluster → Nodes), or run telltale ctl remove-node <node-id> (add --dry-run to see what would happen). Every node then refuses it, even though its certificate is still valid. A node that's up needs --force, and the primary can't be removed. If the machine held the cluster key and can't be trusted, run telltale cluster rotate-ca too.
  • Roll configuration changes out in stages if you like: name canary nodes in Settings → Cluster, and a change reaches them first and everyone else after a bake, pinning back by itself if the canaries start failing. Staged rollouts in the docs.

Keep an eye on it

  • The Cluster page: the summary on top, then Nodes (topology and every node's state), Health (checks with what to do when one fails), Rollouts, and Events. A tab with something wrong shows a count.
  • The health icon at the bottom of the menu turns amber when a node is unreachable or behind on configuration for a minute.
  • Metrics on every node: telltale_cluster_peer_up, telltale_cluster_peer_config_lag, telltale_cluster_behind_seconds, and telltale_cluster_cert_expiry_timestamp_seconds. A replica's telltale_cluster_peer_up lists the primary, the voters under automatic failover, and the peers it is connected to or heard from in the last 15 seconds; the primary lists every node, so scrape it to see a replica that is down. The Helm chart's alert rules cover a peer down, configuration behind, failing syncs, and expiring certificates. telltale_federated_refused_total{reason} counts the cluster reads a node refused, or kept only part of, when too many were waiting, too many calls or bytes were held, or one asked for too much at once: while it grows, the dashboard shows partial results. telltale_cluster_join_refused_total{reason} counts the joins refused by the node that holds the cluster CA (a join sent to another node isn't counted): secret (a wrong secret, which doesn't count toward the 30 joins accepted a minute), limit (past those 30), or request (the rest, such as a token that can't bring what the node asks to be). telltale_cluster_port_connections{kind} counts the connections open on the cluster port (handshake, unauthenticated, member), and telltale_cluster_port_ended_total{reason} those it ended: handshake (too slow in TLS), unauthenticated_lifetime (a connection without a member certificate at its time limit), request_budget (after its 2 requests), unauthenticated_limit (closed to make room for a newer one).
  • Certificates renew themselves: each node's lasts 90 days and is renewed with 30 left. To replace the cluster's certificate authority, run telltale cluster rotate-ca on the primary; DNS keeps answering while it runs. Trust only moves forward: a step of an older version sent again can't bring the retired authority back. One rare case is left: a primary that crashes right after publishing a step can publish that version number again with other content. The docs have the details.

Troubleshooting

What you seeWhat to do
A node is behind on configurationLook at Cluster → Health for its sync error. A node older than the primary keeps serving its last version once the primary uses settings it doesn't know: upgrade it.
The node_settings check failsThat node's own file still sets shared sections (upstreams, lists, groups…). The primary's are used; remove them from the node's file.
The second node can't joinMake sure it can reach the first node's cluster port (8443 by default) at one of the --advertise URLs, and that the token hasn't expired (telltale cluster token list).
Changes are refused with 503There's no primary right now: promote one, or wait for automatic failover. DNS isn't affected.
A node can't connect after a CA rotationIt was away for the whole rotation: join it again with a new token.
Configuration and a CA rotation stop reaching the other nodes after the primary lost cluster/published.json (a full disk and a restart) or its data came back from an older copyIts version went backwards, so the others wait for it to pass theirs; DNS isn't affected. Promote another node (a new epoch beats any version). If none can be promoted, stop each other node, delete its cluster/ca.version and start it again; configuration still waits for the primary to catch up.