High availability

HA levels you can build with Drillo 1.0 using only existing commands. Each level lists what it protects against, RPO, RTO, cost, steps, verification, failback and the test result.

On this page

Drillo has no built-in replication. This guide shows how to get useful availability from version 1.0 with operator-built parts: durable volumes, backups, a collector that buffers, and a second installation.

Labels. TESTED = run in our test environment. UNTESTED = derived from code or docs, not run. ESTIMATE = arithmetic or judgement.

1. Honest limits (read first)#

  • Not a managed service and not a guarantee. You operate it.
  • Tested only on one Mac (arm64), Docker in Docker, test builds, two installs, 2,000 to 2,005 synthetic events, short outages (seconds to about 20 s). Nothing was tested at 700 GB/day, on x86_64, on network volumes, or with a real power cut or volume loss. "Host loss" in the tests means containers removed with volumes and state directory kept.
  • The gate acknowledges an event after a local fsync, then deletes the WAL once ClickHouse accepts it. If the WAL disk is lost with the host, acknowledged events not yet in ClickHouse are lost. Zero loss on host loss needs a WAL volume that survives the host (H0) or a second independent copy (H1).
  • Failover is manual. Nothing switches queries or collectors for you.
  • Collector-side loss is outside Drillo: lines written while the collector itself is down are not collected (in one test, 1,031 of 3,000 lines were lost this way).

2. Levels at a glance#

Cost is relative to one node.

LevelProtects againstRPORTO (search and ingest)Cost vs one nodeTested
H0 recoverable single nodehost loss, process crash, bad disk (if volumes survive)0 acked events if the WAL volume survives; else up to the last backuprebuild about 1 min in the test environment (small data); real RTO = volume reattach + ClickHouse start, ESTIMATE minutes to tens of minutes at 6 TB1.05x to 1.1x (volumes, backup storage, ESTIMATE)partly
H1-lite 7-day hot standbyhost or zone loss, with older data delayed0 for the last 7 days if the collector buffers; older data comes back after restorerecent data searchable at once after a manual switch; days 8 to 30 after restore (ESTIMATE hours)about 1.5xfan-out TESTED, short retention UNTESTED
H1 two full copieshost or zone loss, no data delay0 if collector buffers and acknowledgements holdswitch of queries only, minutes (manual)about 2xfan-out TESTED
H2 replicationautomatic failovern/an/an/anot available

3. What to protect#

A default install creates (names are <name>-..., for example drillo-a-...):

ItemWhereIf lost
ClickHouse datavolume <name>-chdataall events
Gate WALvolume <name>-walacknowledged events not yet shipped
Metadata (users, dashboards, SQLite)volume <name>-metaaccounts and settings
TLS datavolume <name>-caddycertificates reissued
State directory--state DIR: secrets/ (gate token, ClickHouse passwords, HMAC key), tls/ (CA), licence/, clickhouse/config.d/cannot reconnect agents or decrypt; licence

The state directory is small and critical. Back it up off-host, encrypted.

4. H0: one node with a recoverable disk#

4.1 Steps#

  1. Run the installer with --state on a durable path and create the four volumes on durable, host-independent block storage (cloud network volume, SAN, replicated store) before first install. Use Docker volume drivers or bind paths that your platform can reattach. UNTESTED (tests used local volumes).
  2. Size the WAL: it holds events while ClickHouse is down. Default cap DRILLO_WAL_MAX_MB is 4096. At 8.1 MB/s (700 GB/day average) that is about 8 minutes. Raise it in secrets/gate.env and recreate the gate. Rule: cap >= outage you want to ride out x ingest rate, and keep it below the WAL volume size. When full the gate answers 429 (no silent loss in tests).
  3. Size collector buffers (section 7) so the collector holds events while the node is down.
  4. Schedule backups (section 4.3).
  5. Check preflight space: the installer needs at least 20 GiB free on the state path (a smaller path blocks the install).

4.2 Rebuild on a new host#

  1. Reattach the volumes and the state directory to the new host (same paths).
  2. Install the same bundle with the same --state and --name: install.sh --pin <key> --state DIR --name NAME (and --licence, --gate-port, --api-port as before).
  3. Check: drillo status --state DIR --name NAME, then drillo reconcile and drillo gap-report --json.

Reinstalling over a kept data volume skips the install self-test, so existing events are not touched. drillo upgrade is not a way to rebuild: it refuses when the bundle version equals the installed one (TESTED).

Test result (TESTED): all containers removed, volumes and state kept, install of the same bundle took 34 to 68 s, events 2,000 before and 2,000 after, the existing ClickHouse password still worked and drillo status reported the release.

RTO estimate for 6 TB (ESTIMATE, not tested): volume detach and attach is cloud dependent (about 1 to 5 minutes); ClickHouse start grows with part count (5 s for a tiny table here; budget minutes at 6 TB); add installer time. Plan on 10 to 30 minutes and measure it on your platform.

4.3 Backups#

What exists today:

MethodStatusNotes
drillo archive / restore / archive-verifyTESTEDNeeds a licence that includes archive. Exports a time range to a directory (mount object storage there). restore creates drillo.restored_<id>, not the live events table. 2,005 rows archived, restored, checksum equal, archive-verify: PASS. Run it with the licence directory mounted (DRILLO_LICENCE_FILE, DRILLO_LICENCE_DIR).
ClickHouse BACKUP TABLE drillo.events TO File(...)TESTEDNeeds <backups><allowed_path>/var/lib/clickhouse/backups/</allowed_path></backups> in STATE/clickhouse/config.d/drillo.xml and a ClickHouse restart (5 s here). 208 KB for 2,005 rows. Upgrades may rewrite that file from the bundle: re-check after each upgrade (UNTESTED).
BACKUP ... TO S3(...)UNTESTEDNeeds endpoint and credentials in ClickHouse config.
State directoryUNTESTEDtar of STATE (secrets, tls, licence) to encrypted off-host storage, after every change.

Restore of a native backup (TESTED on a second install): copy the backup directory into the target ClickHouse backups path, then

sql
RESTORE TABLE drillo.events AS drillo.events_rst FROM File('/var/lib/clickhouse/backups/ha1');
INSERT INTO drillo.events SELECT * FROM drillo.events_rst SETTINGS insert_deduplicate=0;

Restoring straight over drillo.events failed with "The table has a different definition" between two installs; use the AS form. Both backups are a point in time: events after the backup come only from collector buffers or the WAL volume.

4.4 Verify and fail back#

Verify with the queries in section 9 and drillo status. Fail back by repeating 4.2 on the original host; there is nothing to merge in H0.

5. H1: two full copies#

5.1 Topology#

Two independent installations (drillo-a primary, drillo-b secondary) with different hosts or zones, state dirs and ports. The collector (Vector) sends every event to both. Each gate has its own WAL and ClickHouse.

Test setup: --name drillo-a --gate-port 14318 --api-port 18081 --state S/s-a and --name drillo-b --gate-port 14319 --api-port 18082 --state S/s-b.

5.2 Vector fan-out (TESTED with Vector 0.43.1)#

One source, one transform, two sinks. Per sink: acknowledgements.enabled: true, a disk buffer, endless retry, when_full: block.

yaml
data_dir: /var/lib/vector
sinks:
  a:
    type: http
    inputs: [shape]
    uri: http://<gate-a>:4318/v1/logs     # test setup: plain gate port on the docker network
    method: post
    encoding: {codec: json}
    framing: {method: newline_delimited}
    request: {headers: {Authorization: "Bearer ${TOK_A}"}, retry_attempts: 100000, retry_max_duration_secs: 5, timeout_secs: 10}
    batch: {max_events: 50, timeout_secs: 1}
    acknowledgements: {enabled: true}
    buffer: {type: disk, max_size: 536870912, when_full: block}
  # sink b: same with TOK_B and gate-b
  • Minimum disk buffer is 268,435,488 bytes (256 MiB); a smaller value fails at startup (TESTED).
  • Size max_size as outage you want to ride out x event rate x bytes per event. At 8.1 MB/s, one hour is about 29 GB.
  • Production installs enable TLS by default (internal CA in STATE/tls/ca.pem). Pointing Vector at the TLS port with tls.ca_file is UNTESTED.
  • Use when_full: block so a full buffer slows the source instead of dropping.

5.3 Test result: kill one node mid-ingest (TESTED)#

2,000 events sent through Vector to A and B at about 50 events/s. At event 500 the whole stack of A (gate, ClickHouse, API) was stopped; it was started again 15 batches later and was ingest-ready 1 to 3 s after start.

RunSource eventsA stored (distinct)B stored (distinct)LostDuplicates
12,0002,000 (2,000)1,950 (1,950)0 after release (below)0
22,0001,950 (1,950)1,950 (1,950)0 after release0

Observation: in both runs the last 50 events stayed in Vector (not in ClickHouse) for at least 60 s, until more lines were written to the source (5 extra lines released everything: A and B at 2,005, no duplicates) or until Vector was restarted (run 1: A and B 2,000). The cause was not isolated; it looks like the file source or disk buffer holding a final batch during a lull. In production there is steady traffic, but verify this with your source and alert on "last event age" (section 9). A source of a single quiet stream can sit behind this.

Not tested: Vector itself killed, disk buffer surviving a collector restart under load, duplicates after a lost acknowledgement (Vector retries are at-least-once and the gate gives a retried batch a new sequence, so a duplicate is possible; none was seen). Detect with count() versus uniqExact(<your event id>).

5.4 Queries and switch#

Send users to the primary UI/API. To switch: change DNS or load-balancer target to B (UNTESTED), or tell users the B URL. Dashboards, users and alert rules live in each node's metadata and are not synchronised. Export or recreate them on B.

5.5 Check that the copies agree#

  • Hourly counts on each node, compare outside both:
sql
SELECT toStartOfHour(ts) AS hour, count() AS n FROM drillo.events WHERE ts > now() - 86400 GROUP BY hour ORDER BY hour;

(TESTED, runs). Alert when the difference is above 1% for 15 minutes, ignoring the newest hour.

  • drillo gap-report --from <unix> --json (TESTED, runs, JSON has missing_total). It only sees gaps for sources that report counts (the Drillo agent). Events from Vector over HTTP show up as unreported, so for this topology the hourly counts are the agreement check, not gap-report. drillo reconcile writes the windows gap-report reads.

5.6 Drift repair#

If B missed a range (it was down longer than the collector buffer), copy it from A:

  1. On A: drillo archive --from <U> --to <U> --dir DIR --id fix1 (needs the archive feature), or BACKUP as in 4.3.
  2. On B: restore into a side table (drillo restore or RESTORE ... AS), check counts for the range, then INSERT INTO drillo.events SELECT * FROM <side table> WHERE ts >= ... AND ts < .... First delete or exclude any rows already present, or you will duplicate them. TESTED for the copy mechanics on an empty target; range merge into a non-empty table is UNTESTED.

5.7 Fail back#

Start the failed node, wait for the collector buffer to drain (it retries on its own), compare hourly counts, repair any range (5.6), then move queries back.

6. H1-lite: standby with a 7-day window#

Same topology as H1, but B keeps 7 days (about 1.4 TB at 200 GB/day with headroom) while A keeps 30 (about 6 TB).

  • Setting retention on B: drillo migrate reads DRILLO_RETENTION_DAYS and DRILLO_HOT_DAYS, but the installer does not pass them from your shell, so how to set 7 days on a bundle install is UNTESTED. Options (open a support ticket first): change the TTL on drillo.events after install (ALTER TABLE ... MODIFY TTL), or run migrate by hand with the variables. Do not edit a live table without a backup.
  • After failover: the last 7 days are searchable on B at once, because the collector fed it all along (fan-out TESTED, retention UNTESTED).
  • Lost: nothing acknowledged, if A's volumes or backups survive.
  • Delayed: days 8 to 30 return after you restore A's volumes (H0 rebuild) or load a backup or archive into B (4.3). Duration depends on size: ESTIMATE hours for several TB.
  • Resource cost: about 1.25x the storage and about 1.5x the infrastructure of one node (ESTIMATE). Combine with H0 backups.

7. Collector buffers (applies to all levels)#

Disk buffer on the collector host, acknowledgements per sink, when_full: block, endless retry (5.2). Alert on buffer disk fill (section 9). With the Drillo agent instead of Vector, the agent keeps its own checkpoint and retries (see the agent guide). Protect the collector host too: its buffer is the only copy of events while the node is down.

8. H2 and beyond (not available)#

Missing: replicated tables with ClickHouse Keeper, a multi-gate dedup design, a multi-host installer and cluster upgrades, and replication that does not depend on the single gate WAL. Do not plan on automatic failover in version 1.0.

9. Monitoring and alerts#

The gate prints a stats line every 5 s (the installer sets DRILLO_STATS_S=5) and writes the same counters to drillo.gate_stats. All queries below were run in the test environment.

sql
-- WAL fill, 429 rate, shipper retries
SELECT gate_id, max(wal_bytes) AS wal_max, round(max(wal_bytes)*100/4294967296,1) AS wal_pct,
       sum(received) AS rcv, sum(rejected_429) AS r429, sum(ship_replayed) AS replayed, sum(ship_retries) AS retries
FROM drillo.gate_stats WHERE at > now() - 3600 GROUP BY gate_id;

Replace 4294967296 with DRILLO_WAL_MAX_MB x 2^20. Alert: wal_pct above 70, r429 above 0 for 5 minutes, retries rising (shipper stuck).

sql
-- Parts and size
SELECT table, disk_name, count() AS parts, formatReadableSize(sum(bytes_on_disk)) AS size
FROM system.parts WHERE active AND database='drillo' GROUP BY table, disk_name;
-- Disk free
SELECT name, formatReadableSize(free_space), formatReadableSize(total_space) FROM system.disks;
-- Last event age (ingest stalled or collector lull)
SELECT now() - max(ts) AS seconds_since_last_event FROM drillo.events;

Alert: parts per partition above about 300 (merges behind), free space below 20% or a forecast under 7 days (free space divided by 7-day average growth), seconds_since_last_event above your normal gap.

  • Oldest unshipped age: there is no such metric. Use wal_max growing while ship_batches is flat.
  • Collector buffer fill: du -sk /var/lib/vector against max_size, or Vector's buffer_events internal metrics (UNTESTED). Alert above 70%.
  • Copy disagreement: hourly counts (5.5).
  • Gaps: drillo gap-report --json every 15 minutes (agent sources only).

10. Failure drills#

Expected column: TESTED = seen in a run; otherwise expected from code, UNTESTED.

FailureDetectExpectedDo
Gate crash (kill -9)gate container exits or restarts; connection errors at the collectoracked events not lost; restart drains the WAL. TESTED: 120,000 of 120,000, 0 duplicatesdocker start <name>-gate if it did not restart (docker kill is treated as a manual stop; a crash restarts under unless-stopped)
ClickHouse downgate stats ship_retries up, wal_max up, search errorsgate keeps acking until the WAL cap, then 429. TESTED: 0 loststart ClickHouse; WAL drains (seconds)
Gate and ClickHouse both killedboth downTESTED: 0 lost (SIGKILL, not power loss)start both; run drillo reconcile
WAL disk fullr429 above 0, wal_pct near 100429 not silent loss; collector retries (TESTED: 2,677 x 429, 0 lost)free or grow the WAL volume, fix the shipper stall
ClickHouse disk fullinserts fail, gate WAL growsWAL fills, 429free space or lower retention; plan capacity
Disk loss, volume gonevolume missingdata since last backup lost; WAL contents lostH0: restore backup (4.3), collector buffer refills the gap; H1: repair from the other copy (5.6)
Host losshost unreachableH0: rebuild (4.2); H1: switch queries (5.4)follow the section
Whole stack of one H1 node stoppedcollector retriesTESTED: peer node unaffected, node back ingest-ready in 1 to 3 s, both converge, 0 lost, 0 duplicatesstart the node; compare counts
Bad upgradedrillo status, health checksdrillo rollback returns the previous release (UNTESTED here)drillo rollback --state DIR --name NAME
Reinstall over kept datainstaller output reports that the self-test was skippedTESTED: events keptsee 4.2
Poison batchgate log "ship err seg=... try=N (retrying): HTTP 500"; ship_retries rising; wal_max growing; search shows old dataTESTED: shipping stalls on the rejected batch, nothing lost. Stalled 60 s with 22,500 of 90,000 events searchable, then 0 lostsee below

Poison batch, manual workaround#

ClickHouse rejects one batch for a reason that persists (the test used a constraint; a schema or setting mismatch behaves the same). The gate retries the same batch forever and later batches queue behind it in the WAL.

  1. Read the reason: docker logs <name>-gate | grep "ship err", then ClickHouse SELECT event_time, exception FROM system.query_log WHERE type='ExceptionWhileProcessing' ORDER BY event_time DESC LIMIT 5.
  2. Remove the cause on the ClickHouse side (in the test: dropped the constraint). Do not delete WAL files by hand.
  3. The gate drains by itself: in the test the whole backlog (90,000 events) was searchable 3 s later, 0 lost.
  4. If the cause cannot be removed before the WAL is full, the gate answers 429 and the collector buffer is the only safe place (see section 7).

There is no automatic skip or dead-letter for a bad batch.

11. Testing it yourself#

  1. Install drillo-a and drillo-b from one bundle with different --name, --state, --gate-port, --api-port (about 45 to 70 s each).
  2. Start Vector with the fan-out file; write NDJSON lines with a numeric id.
  3. Stop all containers of A mid-run, start them later.
  4. Compare count() and uniqExact(<id>) on A, B and the number of source lines.
  5. Archive A, restore into B, archive-verify.

12. What you must still do yourself#

Durable and replicated volumes, off-host encrypted backups of the state directory, the switch (DNS or load balancer), dashboard and rule sync between nodes, collector host redundancy, capacity planning, regular restore drills, alerting wiring, and licence handling. Nothing here is measured at your size.

Retention, Sizing and tuning, Install and upgrade, Recipes, Troubleshooting, Known issues.

Report an inaccuracy (opens a support ticket in the portal; nothing is sent from this page)