- One stream process per source instance.
- One periodic maintain process (
oneshot) driven by a timer.
Baseline templates are in examples/systemd/.
- Ensure Python 3.10+ and mysql client tools (
mysql,mysqlbinlog) are available. - Install runtime (
venvor system-wide) somysql-binlog-archiveris executable. - Create service user and runtime directories.
Example:
sudo useradd --system --home /var/lib/mysqlbinlog_archiver --shell /usr/sbin/nologin archiver
sudo install -d -o archiver -g archiver -m 0750 /var/lib/mysqlbinlog_archiver/state
sudo install -d -o archiver -g archiver -m 0750 /var/lib/mysqlbinlog_archiver/reports
sudo install -d -o archiver -g archiver -m 0750 /var/log/mysqlbinlog_archiver
sudo install -d -o root -g root -m 0755 /etc/mysqlbinlog_archiver/instances
sudo install -d -o root -g root -m 0755 /etc/mysqlbinlog_archiver/credentials- Create one JSON file per source in
/etc/mysqlbinlog_archiver/instances/. - Create one defaults-extra-file per source in
/etc/mysqlbinlog_archiver/credentials/. - Set credentials files to mode
0600.
- Copy templates from
examples/systemd/into/etc/systemd/system/. - Verify
ExecStartpoints to the correct binary path (command -v mysql-binlog-archiver). - Keep instance name aligned with
%i.jsonconvention.
sudo cp examples/systemd/mysqlbinlog-archiver@.service /etc/systemd/system/
sudo cp examples/systemd/mysqlbinlog-archiver-maintain.service /etc/systemd/system/
sudo cp examples/systemd/mysqlbinlog-archiver-maintain.timer /etc/systemd/system/
sudo systemctl daemon-reloadsudo systemctl enable --now mysqlbinlog-archiver@mysql-01.example.com.service
sudo systemctl enable --now mysqlbinlog-archiver-maintain.timer- Check stream service state.
sudo systemctl status mysqlbinlog-archiver@mysql-01.example.com.service- Check maintain timer and last run.
sudo systemctl status mysqlbinlog-archiver-maintain.timer
sudo systemctl status mysqlbinlog-archiver-maintain.service- Inspect logs.
sudo journalctl -u mysqlbinlog-archiver@mysql-01.example.com.service -n 100 --no-pager
sudo journalctl -u mysqlbinlog-archiver-maintain.service -n 100 --no-pager- Inspect state and report artifacts.
/var/lib/mysqlbinlog_archiver/state/<source_id>.json/var/lib/mysqlbinlog_archiver/state/_maintain.json/var/lib/mysqlbinlog_archiver/reports/maintain-latest.json
- Confirm binlog files appear and grow in the configured
binlog_dir.
Symptoms:
status=connectivityorlast_error_type=connectivity_bootstrap- stream retries with backoff
Actions:
- Verify source host DNS resolution.
- Verify TCP reachability to source port.
- Verify firewall/network policy.
Symptoms:
last_error_type=auth
Actions:
- Verify credentials in defaults-extra-file.
- Verify source grants for binlog streaming user.
Symptoms:
last_error_type=source_gap
Actions:
- Check source retention and purge policy.
- Adjust bootstrap policy/start file as needed.
Symptoms:
status=disk_full
Actions:
- Free disk/inodes.
- Confirm retention thresholds are reasonable.
- Verify archiver user can delete old closed files.
- Restart one stream unit after config fix:
sudo systemctl restart mysqlbinlog-archiver@mysql-01.example.com.service- Temporarily stop maintain timer:
sudo systemctl disable --now mysqlbinlog-archiver-maintain.timer- Re-enable timer after remediation:
sudo systemctl enable --now mysqlbinlog-archiver-maintain.timerOn successful stream restart, state should return to running and clear previous error fields.