High availability with the current version
HA levels you can build today with the current Drillo release using only existing commands. Each level lists what it protects against, RPO, RTO, cost, steps, verification, failback and the test result.
Verified against v1.0.0-rc.1 · sources
On this page
- 1. Honest limits (read first)
- 2. Levels at a glance
- 3. What to protect
- 4. H0: one node with a recoverable disk
- 4.1 Steps
- 4.2 Rebuild on a new host
- 4.3 Backups
- 4.4 Verify and fail back
- 5. H1: two full copies
- 5.1 Topology
- 5.2 Vector fan-out (TESTED with Vector 0.43.1)
- 5.3 Test result: kill one node mid-ingest (TESTED)
- 5.4 Queries and switch
- 5.5 Check that the copies agree
- 5.6 Drift repair
- 5.7 Fail back
- 6. H1-lite: standby with a 7-day window
- 7. Collector buffers (applies to all levels)
- 8. H2 and beyond (not available today)
- 9. Monitoring and alerts
- 10. Failure drills
- Poison batch, manual workaround
- 11. Testing it yourself
- 12. What you must still do yourself
- 13. Related documents
Drillo has no built-in replication. This guide shows how to get useful availability from the current release with operator-built parts: durable volumes, backups, a collector that buffers, and a second installation.
Labels. TESTED = run in the sandbox, evidence path given. 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, 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 (COC-363 S6b: 1,031 of 3,000 lost).
2. Levels at a glance#
Cost is relative to one node (about $1,011/month infrastructure at 700 GB/day and 30 days, from the COC-382 placeholders). Two full copies cut the saving against the current Loki cluster at 30 days from about $1,971 to about $970/month.
| Level | Protects against | RPO | RTO (search and ingest) | Cost vs one node | Tested |
|---|---|---|---|---|---|
| H0 recoverable single node | host loss, process crash, bad disk (if volumes survive) | 0 acked events if the WAL volume survives; else up to the last backup | rebuild about 1 min in sandbox (small data); real RTO = volume reattach + ClickHouse start, ESTIMATE minutes to tens of minutes at 6 TB | 1.05x to 1.1x (volumes, backup storage, ESTIMATE) | partly |
| H1-lite 7-day hot standby | host or zone loss, with older data delayed | 0 for the last 7 days if the collector buffers; older data comes back after restore | recent data searchable at once after a manual switch; days 8 to 30 after restore (ESTIMATE hours) | about 1.5x | fan-out TESTED, short retention UNTESTED |
| H1 two full copies | host or zone loss, no data delay | 0 if collector buffers and acknowledgements hold | switch of queries only, minutes (manual) | about 2x | fan-out TESTED |
| H2 replication | automatic failover | n/a | n/a | n/a | not available |
3. What to protect#
A default install creates (names are <name>-..., for example drillo-a-...):
| Item | Where | If lost |
|---|---|---|
| ClickHouse data | volume <name>-chdata | all events |
| Gate WAL | volume <name>-wal | acknowledged events not yet shipped |
| Metadata (users, dashboards, SQLite) | volume <name>-meta | accounts and settings |
| TLS data | volume <name>-caddy | certificates 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#
- Run the installer with
--stateon 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 (sandbox used local volumes). - Size the WAL: it holds events while ClickHouse is down. Default cap
DRILLO_WAL_MAX_MBis 4096. At 8.1 MB/s (700 GB/day average) that is about 8 minutes. Raise it insecrets/gate.envand 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, COC-363 S3/S7). - Size collector buffers (section 7) so the collector holds events while the node is down.
- Schedule backups (section 4.3).
- Check preflight space: the installer needs at least 20 GiB free on the state path (this blocked a sandbox run).
4.2 Rebuild on a new host#
- Reattach the volumes and the state directory to the new host (same paths).
- Install the same bundle with the same
--stateand--name:install.sh --pin <key> --state DIR --name NAME(and--licence,--gate-port,--api-portas before). - Check:
drillo status --state DIR --name NAME, thendrillo reconcileanddrillo gap-report --json.
Result with the COC-399 build (TESTED, evidence/coc384/t1-rebuild-fixed-installer.log): all drillo-a 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, drillo status reported the release. The installer printed "skipping selftest + synthetic load: drillo.events already has N row(s)".
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:
| Method | Status | Notes |
|---|---|---|
drillo archive / restore / archive-verify | TESTED | Needs a Paid licence. 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(...) | TESTED | Needs <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(...) | UNTESTED | Needs endpoint and credentials in ClickHouse config. |
| State directory | UNTESTED | tar 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
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.
Sandbox: --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. Full file: evidence/coc384/vector-fanout.yaml.
data_dir: /var/lib/vector
sinks:
a:
type: http
inputs: [shape]
uri: http://<gate-a>:4318/v1/logs # sandbox: 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_sizeas 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 withtls.ca_fileis UNTESTED. - Use
when_full: blockso 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. Evidence evidence/coc384/t2-fanout-run1.log, t2-fanout-run2.log.
| Run | Source events | A stored (distinct) | B stored (distinct) | Lost | Duplicates |
|---|---|---|---|---|---|
| 1 | 2,000 | 2,000 (2,000) | 1,950 (1,950) | 0 after release (below) | 0 |
| 2 | 2,000 | 1,950 (1,950) | 1,950 (1,950) | 0 after release | 0 |
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). I did not isolate the cause; 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:
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 hasmissing_total). It only sees gaps for sources that report counts (the Drillo agent). Events from Vector over HTTP show up asunreported, so for this topology the hourly counts are the agreement check, notgap-report.drillo reconcilewrites the windowsgap-reportreads.
5.6 Drift repair#
If B missed a range (it was down longer than the collector buffer), copy it from A:
- On A:
drillo archive --from <U> --to <U> --dir DIR --id fix1(Paid licence), orBACKUPas in 4.3. - On B: restore into a side table (
drillo restoreorRESTORE ... AS), check counts for the range, thenINSERT 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 migratereadsDRILLO_RETENTION_DAYSandDRILLO_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 to confirm with engineering: change the TTL ondrillo.eventsafter install (ALTER TABLE ... MODIFY TTL), or runmigrateby 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.
- Cost at 30 days: about 1.25x storage and about 1.5x infrastructure of one node, so the saving against Loki falls from about $1,971 to about $1,470/month (ESTIMATE from the COC-382 figures). 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 today)#
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. Estimate 16 to 24 person-weeks. Design: COC-383, document ha-plan. Do not plan on automatic failover from this release.
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 ran on the sandbox.
-- WAL fill, 429 rate, shipper retries (corrected: do not alias an aggregate over its own column)
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).
-- 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_maxgrowing whileship_batchesis flat. - Collector buffer fill:
du -sk /var/lib/vectoragainstmax_size, or Vector'sbuffer_eventsinternal metrics (UNTESTED). Alert above 70%. - Copy disagreement: hourly counts (5.5).
- Gaps:
drillo gap-report --jsonevery 15 minutes (agent sources only).
10. Failure drills#
Result column: TESTED / COC-363 = seen in a run; otherwise expected from code, UNTESTED.
| Failure | Detect | Expected | Do |
|---|---|---|---|
| Gate crash (kill -9) | gate container exits or restarts; connection errors at the collector | acked events not lost; restart drains the WAL. COC-363 S4: 120,000 of 120,000, 0 duplicates | docker start <name>-gate if it did not restart (docker kill is treated as a manual stop; a crash restarts under unless-stopped) |
| ClickHouse down | gate stats ship_retries up, wal_max up, search errors | gate keeps acking until the WAL cap, then 429. COC-363 S1, S2: 0 lost | start ClickHouse; WAL drains (seconds) |
| Gate and ClickHouse both killed | both down | COC-363 S5: 0 lost (SIGKILL, not power loss) | start both; run drillo reconcile |
| WAL disk full | r429 above 0, wal_pct near 100 | 429 not silent loss; collector retries (COC-363 S7: 2,677 x 429, 0 lost) | free or grow the WAL volume, fix the shipper stall |
| ClickHouse disk full | inserts fail, gate WAL grows | WAL fills, 429 | free space or lower retention; plan capacity |
| Disk loss, volume gone | volume missing | data since last backup lost; WAL contents lost | H0: restore backup (4.3), collector buffer refills the gap; H1: repair from the other copy (5.6) |
| Host loss | host unreachable | H0: rebuild (4.2); H1: switch queries (5.4) | follow the section |
| Whole stack of one H1 node stopped | collector retries | TESTED: peer node unaffected, node back ingest-ready in 1 to 3 s, both converge, 0 lost, 0 duplicates | start the node; compare counts |
| Bad upgrade | drillo status, health checks | drillo rollback returns the previous release (UNTESTED here) | drillo rollback --state DIR --name NAME |
| Reinstall over live data | installer output | older releases truncate events (COC-399) | never install over data until fixed; see 4.2 |
| Poison batch | gate log "ship err seg=... try=N (retrying): HTTP 500"; ship_retries rising; wal_max growing; search shows old data | COC-363 S9: shipping stalls on the rejected batch, nothing lost. Stalled 60 s with 22,500 of 90,000 events searchable, then 0 lost | see below |
Poison batch, manual workaround#
ClickHouse rejects one batch for a reason that persists (S9 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.
- Read the reason:
docker logs <name>-gate | grep "ship err", then ClickHouseSELECT event_time, exception FROM system.query_log WHERE type='ExceptionWhileProcessing' ORDER BY event_time DESC LIMIT 5. - Remove the cause on the ClickHouse side (S9: dropped the constraint). Do not delete WAL files by hand.
- The gate drains by itself: in S9 the whole backlog (90,000 events) was searchable 3 s later, 0 lost.
- 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 today.
11. Testing it yourself#
- Install
drillo-aanddrillo-bfrom one bundle with different--name,--state,--gate-port,--api-port(about 45 to 70 s each). - Start Vector with the fan-out file; write NDJSON lines with a numeric id.
- Stop all containers of A mid-run, start them later.
- Compare
count()anduniqExact(<id>)on A, B and the number of source lines. - Archive A, restore into B,
archive-verify.
The sandbox script and logs are in evidence/coc384/. The harness for single-node faults is scripts/bench/ft.sh and fault.py (COC-357, COC-363).
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.
13. Related documents#
retention.md, sizing-tuning.md, install.md, ingest-recipes.md, troubleshooting.md, known-issues.md. Design for real HA: COC-383 (ha-plan).