Database Connections
Configure the source, destination, and replica connections, and the privileges each account needs.
GoArchive connects to a source server, a destination server, and optionally a replica.
Source and destination
source:
host: source-db.internal
port: 3306
user: archiver
password: change_me
database: production
tls: preferred
max_connections: 10
max_idle_connections: 5
destination:
host: archive-db.internal
port: 3306
user: archiver
password: change_me
database: archive
tls: preferred
max_connections: 10
max_idle_connections: 5
| Setting | Description | Default |
|---|---|---|
host | Server hostname | required |
port | Server port | 3306 |
user | Account name | required |
password | Account password | |
database | Database name | required |
tls | disable, preferred, skip-verify, or required | preferred |
max_connections | Maximum open connections | 10 |
max_idle_connections | Maximum idle connections | 5 |
Tracking tables
GoArchive keeps its progress records on the destination server. By default they
live alongside the archived data, in destination.database.
To keep them separate, name a schema of their own:
destination:
database: archive
job_schema: goarchive
The schema must exist before the first run; GoArchive creates its tables inside it but does not create the schema itself.
Replica monitoring
Configure a replica to have GoArchive pause while replication falls behind:
replica:
enabled: true
host: replica-db.internal
port: 3306
user: repl_user
password: change_me
replication_channel: ""
Leave replication_channel empty to monitor the default channel, or name one to
scope the check. Thresholds are set in
Processing and Safety
.
Privileges
| Server | Privileges | Used for |
|---|---|---|
| Source | SELECT | Reading the rows to move |
| Source | DELETE | Removing them β archive and purge only |
| Source | SELECT ON *.* | Confirming that no table outside the job references data inside it |
| Destination | SELECT, INSERT | Writing archived rows |
| Tracking schema | CREATE, SELECT, INSERT, UPDATE | Maintaining progress records |
| Replica | REPLICATION CLIENT | Reading replication status |
-- source
GRANT SELECT, DELETE ON production.* TO 'archiver'@'%';
GRANT SELECT ON *.* TO 'archiver'@'%';
-- destination, tracking tables alongside the data
GRANT SELECT, INSERT, CREATE, UPDATE ON archive.* TO 'archiver'@'%';
-- replica, if configured
GRANT REPLICATION CLIENT ON *.* TO 'archiver'@'%';
The copy workflow never removes anything, so it does not need DELETE on the
source.
validate confirms the account holds what the run requires and reports anything
missing:
goarchive validate -c archiver.yaml
Credentials
The configuration file contains passwords. Restrict it accordingly:
chmod 600 archiver.yaml
GoArchive never writes credentials or connection strings to its logs.
