How-to
Failsafe ingest with InfluxDB Edge Data Replication
Short answer
Run InfluxDB Edge Data Replication from the primary to a standby and size its persistent queue at least as large as measured bytes per second written times the longest tolerated standby outage in seconds. Telegraf dual-write buffers live only in memory and vanish on restart, and a daily copy leaves up to a day unprotected, so neither meets a no-loss goal on its own.

On this page
Three goals sit behind a failsafe InfluxDB ingest: no accepted point is ever lost, every sensor reading actually gets written, and reads keep working when a server dies. Each goal belongs to a different layer, so work the steps below in order. For the second copy, InfluxDB OSS v2 gives you Edge Data Replication: the primary stays the single write target, pushes each accepted point into an on-disk queue, and forwards it to a standby bucket. Size that queue as measured bytes per second written multiplied by the longest standby outage you will tolerate — that product is the real data-loss boundary. Telegraf dual-write is the fallback, not the plan, because its buffers live in memory, and a daily copy cannot meet a no-loss goal. Keep the nightly backup running underneath.
Choose the copy mechanism before anything else #
The duplicate has to be created somewhere, and each place fails differently.
| Mechanism | How the second copy is made | What an outage costs |
|---|---|---|
| Edge Data Replication | The primary queues every accepted point on disk and forwards it to the remote bucket | Nothing, while the queue stays under its size limit; past the limit, the oldest queued points drop |
| Two Telegraf outputs | Telegraf writes to both servers, each output with its own buffer | The buffer is memory-only and empties when Telegraf restarts; every outage leaves a gap nothing back-fills |
| Scheduled copy | Batch export and import between the servers | The standby trails by up to the copy interval; a primary failure loses everything since the last copy |
Commit to the first row when both servers run OSS v2: one write target, a persistent queue, and Telegraf configuration that never changes at failover time. Take the second row only when a 1.x server rules the stream out or the primary genuinely cannot carry the forwarding load. Run the third as a backup supplement, never as the failover path.
Create the remote and the replication stream #
- Read the version on both servers with
influx version. Edge Data Replication belongs to the OSS v2 line, and the target must be a v2-compatible instance: a second OSS v2 server or a cloud instance. - On the standby, create the destination bucket and an API token with write permission on that bucket.
- From the primary host, prove the network path first by reaching the standby's HTTP port, 8086 by default — on Windows, for example,
Test-NetConnection 192.168.1.20 -Port 8086, substituting your standby's address. - Create the remote connection on the primary with
influx remote create, passing the standby's URL, the org ID and the token. Confirm withinflux remote list; the entry must show the standby's URL exactly. - Create the stream with
influx replication create, naming the local source bucket, the remote connection and the remote bucket ID, and set the queue size explicitly — read the exact flag spelling and its default frominflux replication create --helpon your installed version. Sizing is the next section; do it before the first real outage. - Run
influx replication list. The stream must report a current queue size near zero, the maximum you set, and a clean latest status. - Write a test point to the source bucket, then query the standby bucket for it. Trust the query, not the HTTP status of the write — why InfluxDB OSS 2.0 returns HTTP 200 for bad URLs shows that a success code proves nothing about where a point landed.
If the copy has to run from a cabinet gateway rather than a plant server, the companion procedure is how InfluxDB remote replication works from an edge gateway.
Size the queue from the measured write rate #
The queue limit is the actual data-loss boundary during a standby outage, so derive it; never inherit the default. The queue persists to disk in segments of 10 MB, and the queue manager revisits it about once a minute — that is the resolution at which over-limit data starts going away.
The requirement in words: queue bytes must be at least the bytes per second written, multiplied by the longest tolerated outage in seconds. Take the rate from measurement, not from tag counts — bucket growth over a known period divided by the seconds in that period, 86,400 for a day. The method in estimate historian disk space from measured daily growth produces exactly that growth figure.
Worked example, in decimal gigabytes:
- Measured growth on the primary: 1.8 GB over one day.
- Longest standby outage you tolerate: 72 hours.
- Rate: 1.8 × 10^9 B ÷ 86,400 s ≈ 20,833 B/s, call it 21 kB per second.
- Outage in seconds: 72 × 3,600 = 259,200 s.
- Queue: 20,833 B/s × 259,200 s ≈ 5.4 × 10^9 B = 5.4 GB. Cross-check the shortcut: three days of growth is 3 × 1.8 GB = 5.4 GB.
Set the limit at 6 GB — the requirement rounded up to the next whole gigabyte — and confirm the primary's disk carries that on top of its own data and headroom. One hour of standby downtime costs about 75 MB of queue (1.8 GB ÷ 24). If 6 GB will not fit the disk, shorten the tolerated outage and add monitoring; do not shrink the queue below the arithmetic and hope.
Close the gaps upstream of InfluxDB #
Replication protects only what the primary has already accepted. Between a LoRaWAN network server and the bucket sit two more buffers, and both need the same rate-times-outage treatment:
- The Telegraf output buffer. Each
[[outputs.influxdb_v2]]block carriesmetric_buffer_limit, the documented bound on metrics held while writes fail; the agent'sflush_intervalsets how often a flush is attempted, not how much survives waiting. Size the limit with the same arithmetic in metrics — points per second times tolerated outage seconds, taken from your measured point rate — and remember the restart behavior from the table above: whatever is waiting in that buffer is lost, whatever the limit. - The MQTT hop. Give the consumer input a persistent session and QoS 1. MQTT's QoS 1 means at-least-once delivery: the broker holds messages for an offline subscriber that has a persistent session and releases them on reconnect. Prove it once — stop Telegraf for a minute, restart it, and confirm the sensor series shows no gap. The consumer wiring is in storing MQTT messages in InfluxDB with Telegraf.
- The error signal. Repeated write failures with a growing buffer mean the primary is rejecting or not answering. That is an ingest fault, and no replication setting will fix it.
Run the drill and fix the failover rule #
- Pick one sensor series and count its points on both servers over the last hour with the same Flux
count()query. Record both numbers. - Stop the standby's InfluxDB service for one hour, inside the queue's capacity. On the primary,
influx replication listmust show the queue growing by about an hour's worth of writes while ingest continues unaffected. - Start the standby and watch the queue drain back to near zero. Time the drain: queued bytes divided by that time is your real forwarding throughput, the number that tells you how long a full queue takes to catch up.
- Re-run the count query on both servers over the same window. The counts must match, and Grafana pointed at the standby must show the outage window without gaps.
- Write the failover rule down before you need it. Replication is one-directional and the standby is a read replica, so promotion is a manual or scripted step: someone changes the Telegraf output URL and restarts the service, on a trigger you define now. While a backlog drains, the standby trails reality — label that on any dashboard an incident is being run from.
- When the primary returns, reconcile the points written only to the standby before resuming replication in the original direction. The stream will not reverse itself.
Repeat the drill after any change that moves the write rate or the stream configuration; the queue limit is only correct against the rate it was computed from.
Questions asked
Can the replication target be an InfluxDB 1.x server?
No. The stream is documented for the OSS v2 line and needs a v2-compatible target, either a second OSS v2 server or a cloud instance, and it does not run from a 1.x primary either. If one server is on 1.x, upgrade it or run the Telegraf dual-output fallback and plan around its restart gap.
How long does the standby take to catch up after it comes back?
Drain time is queued bytes divided by forwarding throughput, and throughput depends on the link and the standby's write speed. In the worked example an hour of outage queues about 75 MB, which drains in about 15 seconds at an illustrative 5 MB per second on a LAN; a full 5.4 GB queue at that rate needs about 18 minutes. Measure your own throughput by timing the drain during the outage drill.
Does Edge Data Replication replace the nightly backup?
No. The stream forwards everything the primary accepts, including accidental deletions and bad writes, so it reproduces mistakes on the standby almost immediately. Keep the nightly export or snapshot, and restore-test it on an isolated instance against known tags and timestamps; a backup that has never been restored is a hope, not a recovery plan.
Can Grafana read from the standby while replication is healthy?
Yes. The standby holds a near-live copy, so a second Grafana data source with the same bucket schema spreads read load and keeps dashboards alive through a primary failure. Just remember the standby trails by whatever is still queued; after a long outage that is the whole backlog until the drain finishes.
What should I watch on the replication stream day to day?
Three values from influx replication list: current queue size against the maximum, the latest status code, and the return to near zero after any standby downtime. A near-zero queue with a clean status means the standby keeps up; a queue that climbs while the primary is healthy points at the standby or the network, not at ingest.

