DBTrail

Install from Linux packages

DBTrail on a Linux host without Docker, from the .deb or .rpm, as a systemd service that starts at boot and restarts after a crash.

A browser reaches DBTrail through an SSH tunnel, or nginx, to port 8090. DBTrail runs as one systemd service, capture and web interface together. Below it: /etc/bintrail holds its settings in one file that upgrades keep; /var/lib/bintrail holds what it saves, the servers, the login and its work folders; your own MySQL is the index, on this machine or another; the source is your database, read like a replica.

One service runs what the Docker Compose stack runs: capture and the web interface. You add servers in the web interface, as with Compose.

Before you start

  • A Linux host with systemd, amd64 or arm64: Debian 12, Ubuntu 22.04, RHEL, Rocky or AlmaLinux 9, Amazon Linux 2023, or newer. On anything older the program does not start.
  • An index MySQL, 8.0 or newer, on this machine or another. Its user creates databases: bintrail_index and one bintrail_idx_<id> per server.
  • DBTrail 0.103.0 or newer. Older packages bring the program and no service.

Install

V=0.103.0
curl -fsSLO https://github.com/dbtrail/dbtrail/releases/download/v$V/bintrail-console_${V}_linux_$(dpkg --print-architecture).deb
sudo apt install ./bintrail-console_${V}_linux_*.deb
V=0.103.0
A=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')
curl -fsSLO https://github.com/dbtrail/dbtrail/releases/download/v$V/bintrail-console_${V}_linux_$A.rpm
sudo dnf install ./bintrail-console_${V}_linux_$A.rpm

Nothing starts yet. The package put four things on the machine:

bintrail-console.serviceThe service: starts at boot, restarts after a crash
/etc/bintrail/bintrail-console.envIts settings. Upgrades never overwrite this file
/var/lib/bintrailWhat DBTrail saves: your servers, the login, its work folders
a bintrail accountThe user the service runs as. It cannot log in

Start it

Put the index in the settings file, then start the service:

sudoedit /etc/bintrail/bintrail-console.env
BINTRAIL_INDEX_DSN=dbtrail:password@tcp(127.0.0.1:3306)/bintrail_index
sudo systemctl enable --now bintrail-console

enable makes it start at boot; --now starts it right away. To watch it:

systemctl status bintrail-console
journalctl -u bintrail-console -f

Sign in

The web interface answers on 127.0.0.1:8090, this machine only. From your own computer, open a tunnel and leave it running:

ssh -L 8090:127.0.0.1:8090 you@the-host

Open http://127.0.0.1:8090, pick a username and password, and add your server: Quick Start, Sign in. If your MySQL runs on the same host as DBTrail, its Host is 127.0.0.1.

For a name everyone on your team can open, with HTTPS: Web interface on a hostname.

For the first copy: mydumper

The first copy reads your whole database with mydumper, which the package does not bring. Install it on this host. Pick the file for your system and processor from the mydumper releases, the version DBTrail is tested with. Two examples, both for amd64:

curl -fsSLO https://github.com/mydumper/mydumper/releases/download/v1.0.3-1/mydumper_1.0.3-1.noble_amd64.deb
sudo apt install ./mydumper_1.0.3-1.noble_amd64.deb
sudo dnf install https://github.com/mydumper/mydumper/releases/download/v1.0.3-1/mydumper-1.0.3-1.el9.x86_64.rpm

A full read stages about the size of your data, uncompressed, under /var/lib/bintrail/baseline-staging. To use another disk, change BINTRAIL_CONSOLE_BASELINE_STAGING in the settings file and give the bintrail account that folder.

Upgrade

Install the newer package the same way. The service restarts on the new version by itself, capture resumes from where it stopped, and your settings file is left as it is.

Uninstall

sudo apt remove bintrail-console
sudo dnf remove bintrail-console

This stops the service and removes the program. Your settings, your servers, the login and the snapshots on disk stay, so installing again finds them; run sudo systemctl enable --now bintrail-console after it. To delete them too:

sudo rm -rf /var/lib/bintrail /etc/bintrail
sudo userdel bintrail

The index MySQL is yours and is never touched.

More

  • Every setting is a line in /etc/bintrail/bintrail-console.env, with a comment above it. After a change: sudo systemctl restart bintrail-console. A newer version never edits your file; its current text is in /usr/share/bintrail-console/bintrail-console.env.
  • Changing the service itself (a memory limit, another user): sudo systemctl edit bintrail-console. That survives upgrades.
  • Snapshots in S3: give the host an instance role, or put AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION in the settings file. S3 policy.
  • The MySQL port (Query Parquet with MySQL): turn it on in the web interface. A second service of the same package, bintrail-router, answers it on port 3309. The package starts it.
  • Alerts: uncomment BINTRAIL_METRICS_ADDR and alert when bintrail_stream_last_flush_timestamp_seconds goes stale: Alerts.
  • Run one DBTrail per source. If this host dies, start it on another one with the same index and a copy of /var/lib/bintrail: when the host dies.
  • The command line (bintrail query, bintrail recover) is a separate package, bintrail, installed the same way.

On this page