DBTrail

Architecture

What DBTrail is made of, what connects to what, what it never does to your database, and what stays on your side.

DBTrail is one process, capture plus web interface, on a machine you run. Your database, the source, sends it changes and is read like a replica, with nothing installed in it. DBTrail writes to two places: the index, a MySQL of yours that holds the last hours of changes, before and after; and Parquet files, on disk or in S3, with a snapshot of every table and, in S3, the older hours. Three things read from DBTrail: your browser on port 8090, the web interface; a MySQL client on port 3309, SQL on the copy, optional; and Claude on port 8090 at /mcp, read-only, with a token. DuckDB on your machine reads the Parquet files directly.

DBTrail is one program that you run next to your database. It follows every row change the way a replica does, keeps the recent ones in a MySQL of its own and the older ones as Parquet files, and lets you read all of it. Nothing runs inside your database, and no data leaves machines you control.

The parts

Your database (the source). MySQL, MariaDB or PostgreSQL, wherever it already runs. DBTrail connects to it with one account, like a replica would, and reads the changes it already writes to its binary log (on PostgreSQL, its write-ahead log). It stores nothing there.

DBTrail. One process (bintrail-console watch) that does three jobs: it captures the changes, it serves the web interface, and it builds the Parquet files. It runs on a Linux machine or container of yours. It keeps a few small files of its own: the list of servers you added, the login, and the settings. Run exactly one per source. A second one pointed at the same index waits its turn; it does not capture twice.

The index. A MySQL 8.0 or newer that DBTrail writes to. Every change lands here within seconds, with the row as it was before and as it is after. It holds the last hours (48 by default) and the position capture resumes from after a restart. The Docker Compose stack brings one. Anywhere else you point DBTrail at one of yours, for example RDS.

Parquet files. Two kinds:

  • Snapshots: every table as one file, at one moment, in a folder or an S3 bucket you choose. The first comes from a full read of your database. Later ones are built from the previous snapshot plus the changes, without reading your database again.
  • Hourly archives: with an S3 bucket set, each hour that leaves the index becomes one file there, so the history goes back further than the index does. Without one, those hours are dropped.

How they fit together: How the Parquet copy works.

What reads it.

  • The web interface, in your browser: history of a row, undo SQL, snapshots, checks, settings.
  • DuckDB on your own machine, reading the Parquet files directly. DBTrail is not in the path: Query with DuckDB.
  • A MySQL client, through a port you turn on: Query Parquet with MySQL.
  • Claude, read-only, with a token you create: Connect Claude.

What connects to what

Every connection to your database and to the index starts from DBTrail. Neither ever connects back.

FromToPortFor
DBTrailYour database3306 (PostgreSQL: 5432)Reading changes. A full read, when one is needed
DBTrailThe index3306Writing changes and reading them back
DBTrailS3443Archives and snapshots. Only with an S3 location set
DBTrailtelemetry.dbtrail.com443Usage statistics with no data in them. What is sent, and how to turn it off
DBTrailA webhook of yours443Alerts. Only if you set one
Your browser, ClaudeDBTrail8090The web interface and /mcp
A MySQL clientDBTrail3309SQL on the copy. Off until you turn it on. No TLS
PrometheusDBTrail9090Metrics. On in the Compose stack, elsewhere only if you set an address: Alerts

The Docker Compose stack publishes its ports on 127.0.0.1 only. Nothing is reachable from another machine until you open it: Web interface on a hostname.

What DBTrail never does to your database

  • It installs nothing in it. No plugin, no extension, no trigger, no table. On PostgreSQL it creates one replication slot, as any replica does.
  • It never runs the SQL it generates. Undo SQL and .sql exports are files. You read them and run them yourself.
  • Its account cannot change your data. It has the rights a replica needs, SELECT, and for snapshots the right to take the short lock described below. The SQL for DBTrail's user.

Two things to know before you say yes:

  • A full read makes writes wait for an instant. The first snapshot, and any later one that has to read your database, copies every table with mydumper. At its start, writes wait a few hundredths of a second so that every table is copied at the same moment. Something already running on your database can stretch that wait: How a snapshot stays point-in-time.
  • One feature can pass statements to your MySQL, and it is off unless you turn it on. Read routing on the MySQL port passes a client's statements to your MySQL. It refuses writes unless you allow them.

What stays on your side

DBTrail is software you run, not a service. It does its own work; the machines under it are yours.

DBTrail doesYou do
Captures, and resumes from where it stopped after a restartKeep the process running. Compose and ECS restart it for you
Creates and updates its tables in the index, and drops old hoursRun the index MySQL: disk, backups, upgrades
Writes archives and snapshots, and checks that they rebuild correctlyOwn the bucket or folder: access, encryption, how long files stay
Shows when capture breaks or a check fails, and alerts you if you set that upDecide who can reach the web interface, and put HTTPS in front
Refuses to start capturing from a source it cannot read correctlyKeep the source's binary log in row format with full row images

There is no automatic failover. If the machine is lost, you start DBTrail on another one, and capture resumes from the position saved in the index as long as your database still has those binary logs. So keep the index on a different machine than DBTrail when losing history for a while is not acceptable.

History starts the day you install it, and it is not your backup: Limitations.

Next

On this page