DBTrail

Quick Start

Try DBTrail on one machine in a few steps, and run your first heavy query from your mysql client.

Try it on one machine: install, connect your MySQL, and run a heavy query from your mysql client. The same steps with no browser: From the terminal. For a server you keep running, the same setup as configuration: In production.

You need

  • Docker with Compose, and the mysql client, on the machine that runs DBTrail.
  • A MySQL login that can create users, once, to create DBTrail's own user.
  • Row binlogs and a primary key on every InnoDB table. Check the binlog with SHOW VARIABLES WHERE Variable_name IN ('log_bin', 'binlog_format', 'binlog_row_image'); and look for ON, ROW, FULL.

MySQL and Percona Server 8.0, 8.4 and 9.7 (not the 9.0 to 9.6 Innovation releases), including RDS and Aurora (read this first).

1. Install

curl -fsSL https://raw.githubusercontent.com/dbtrail/dbtrail/main/install.sh | sh

It installs the newest version and writes it to .env, so the stack stays on it until you upgrade. It opens http://127.0.0.1:8090. Pick a username and password.

2. Connect your MySQL

The form to add your server opens by itself. Fill in Host and Port (on this same machine, the host is host.docker.internal) and press Find it. Run the SQL the form shows on your MySQL, then press I ran it.

3. Take the first copy

Snapshots → Read database now. DBTrail reads every table once, with a short lock to read them at one moment, so pick a quiet time. To keep the copy current, turn on Update the copy on the same page.

4. Turn on the MySQL port

Settings → MySQL clients → Turn on. Copy the mysql line and the password it shows.

5. Run a heavy query

mysql -h 127.0.0.1 -P 3309 -u <your server's name> -p
USE <your database>;
SELECT c.tier, count(*) AS orders, round(sum(o.total), 2) AS revenue
FROM orders o JOIN customers c ON c.id = o.customer_id
GROUP BY c.tier ORDER BY revenue DESC;

That query did not slow down your MySQL.

Next

On this page