backup mysql-db-list
Batch backup of multiple databases in one instance of MySQL.
Command Format:
peppykeep backup mysql-db-list --request-file <FILE> [--apply] [--config-home <DIR>]
Description
--request-file<FILE>: Request file path, supportsjsonandtoml.--apply: really performs the backup; only the summary is output when not imported.--config-home<DIR>: configuration directory.bak.tomlstill provides MySQL connection parameters, object storage configuration, encryption configuration, and local backup directory.
dry-run example
peppykeep backup mysql-db-list \
--request-file ./mysql_bak_request.toml \
--config-home /data/conf/peppykeep/mysql-bak
The output summary will include:
RequestFileInstanceDbCountUploadLocalCleanupRemoteCleanupDocker
Execution Example
peppykeep backup mysql-db-list \
--request-file ./mysql_bak_request.toml \
--config-home /data/conf/peppykeep/mysql-bak \
--apply
TOML Example
instance_name = "mysql_instance_a"
upload_to_oss = true
remove_older_files = true
remove_older_oss_files = true
[base]
uuid = ""
name = "mysql_bak"
desc = "backup multiple mysql databases"
[[db_config_list]]
db_name = "db_a"
include_table_list = []
exclude_table_list = []
[[db_config_list]]
db_name = "db_b"
include_table_list = []
exclude_table_list = ["large_table_1", "large_table_2"]
JSON Example
{
"base": {
"uuid": "",
"name": "mysql_bak",
"desc": "backup multiple mysql databases"
},
"instance_name": "mysql_instance_a",
"container": {
"docker_container_name": "mysql-container-a",
"docker_cmd_path": "/usr/bin/docker"
},
"db_config_list": [
{
"db_name": "db_a",
"include_table_list": [],
"exclude_table_list": []
},
{
"db_name": "db_b",
"include_table_list": [],
"exclude_table_list": [
"large_table_1",
"large_table_2"
]
}
],
"upload_to_oss": true,
"remove_older_files": true,
"remove_older_oss_files": true
}
Table Filter Rules
*: matches any length character?: matches a single character[abc]: matches one character in the character set[a-z],[0-9]: matches character range
Example:
[[db_config_list]]
db_name = "db_c"
include_table_list = ["user_*", "order_2026??", "log_[0-9][0-9]"]
exclude_table_list = []
exclude_table_list does not take effect when include_table_list is not empty. When the pattern in include_table_list does not match any table, the command reports an error directly.
Behaviour description
- Read
request-file - Export each database in
db_config_listin turn - Package and compress multiple
.sqlfiles - Configure to generate encrypted files when encryption is enabled
- Upload object store when
upload_to_oss = true - Clean up local history files when
remove_older_files = true - Clean remote history files when
remove_older_oss_files = true