Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Batch Backup Database

Multiple libraries need to be backed up at once under the same MySQL instance, and the filtering rules of each library table may be different. Use mysql_bak_request.toml with backup mysql-db-list.

Backup to local

enforce_provisioning_action

1. bak.toml — need to include MySQL connection and local path (bak_type has no effect on mysql-db-list but [mysql] is required):

[public]
bak_location_type = "local"
history_bak_num = 3
log_level = "DEBUG"
log_dir = "/tmp/logs/peppykeep"
local_bak_home = "/tmp/backup/peppykeep"
local_tmp_home = "/tmp/.peppykeep_tmp"
max_bak_queue_size = 1

[mysql]
mysql_ip = "127.0.0.1"
mysql_port = 3306
mysql_user_name = "root"
mysql_pwd = "root"
mysqldump_path = "/usr/local/bin/mysqldump"
skip_ssl = true

See bak.toml configuration for all parameters.

2. mysql_bak_request.toml

instance_name = "test_717_file11111"
upload_to_oss = false
remove_older_files = true
remove_older_oss_files = false   # Must be false when upload_to_oss is false

[base]
uuid = ""
name = "batch-mysql-task"
desc = "backup multiple databases"

[[db_config_list]]
db_name = "7.12database1"
include_table_list = []
exclude_table_list = []

[[db_config_list]]
db_name = "7.12database2"
include_table_list = []
exclude_table_list = []

See mysql_bak_request.toml for details.

Perform the preliminary checks: §.

peppykeep backup mysql-db-list \
  --request-file ~/.peppykeep/conf/mysql_bak_request.toml \
  --config-home ~/.peppykeep/conf

When the pre-test is successful, the output is as follows:

=== Dry Run ===
Action        : backup mysql-db-list
RequestFile   : /path/to/user/.peppykeep/conf/mysql_bak_request.toml
Instance      : test_717_file11111
DbCount       : 2
Upload        : false
LocalCleanup  : true
RemoteCleanup : false
Docker        : <none>
Next          : Re-run with --apply to execute.
FieldDescription
ActionPin to backup mysql-db-list
RequestFileRequest file path
Instancecorresponding to instance_name
DbCountNumber of libraries in db_config_list
UploadCorresponds to upload_to_oss
LocalCleanupcorresponds to remove_older_files
RemoteCleanupcorresponds to remove_older_oss_files
DockerContainer backup configuration; <none> when not configured
NextFormal execution after adding `--apply’

Perform a backup

peppykeep backup mysql-db-list \
  --request-file ~/.peppykeep/conf/mysql_bak_request.toml \
  --apply \
  --config-home ~/.peppykeep/conf

Example output on success:

=== Completed ===
Action        : backup mysql-db-list
RequestFile   : /path/to/user/.peppykeep/conf/mysql_bak_request.toml
Instance      : test_717_file11111
DbCount       : 2
Upload        : false
LocalCleanup  : true
RemoteCleanup : false
Docker        : <none>
Status        : Command completed successfully.

Backup to Object Storage

Set upload_to_oss = true in mysql_bak_request.toml and configure [object_storage] in bak.toml. For upload and retention, see Upload Backup Files to Object Storage and bak.toml.

Order Details Reference

v26.10.2001+202610201530