{"id":22908856,"url":"https://github.com/ipunkt/docker-xtrabackup","last_synced_at":"2025-05-08T23:09:21.669Z","repository":{"id":55352364,"uuid":"82065026","full_name":"ipunkt/docker-xtrabackup","owner":"ipunkt","description":"xtrabackup with entrypoint script","archived":false,"fork":false,"pushed_at":"2021-01-05T03:49:38.000Z","size":6108,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-08T23:09:17.155Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipunkt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-15T13:44:33.000Z","updated_at":"2023-06-30T10:05:34.000Z","dependencies_parsed_at":"2022-08-14T22:01:35.741Z","dependency_job_id":null,"html_url":"https://github.com/ipunkt/docker-xtrabackup","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fdocker-xtrabackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fdocker-xtrabackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fdocker-xtrabackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipunkt%2Fdocker-xtrabackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipunkt","download_url":"https://codeload.github.com/ipunkt/docker-xtrabackup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160777,"owners_count":21863629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T03:32:44.100Z","updated_at":"2025-05-08T23:09:21.654Z","avatar_url":"https://github.com/ipunkt.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xtrabackup\nThis image uses martinhelmich/xtrabackup as a base and tries to provide an\nentrypoint to support full backup and restore procedures from within rancher\n\n## Use case\nThe image is built with the following use case in mind:\n\n- There is a running mysql flavored server(mysql, mariadb, percona xtradb) which\nhas `/var/lib/mysql` on a named volume[1]  \n- Backups are written to a named volume on a convoy vfs - mounted to a hetzner\nstoragebox(cifs)  \n- Restore is done by starting a new server container, shutting it down, removing\nthe data directory and restoring from the backup.\n- A full restore is achieved by switching the sql load balancer to the new\ncontainer.\n- A partial restore is done by attaching a pma to the new container and copying\nthe intended data.\n- This is tested on a percona xtradb galera cluster\n\n[1] it is also possible to use the image via --volumes-from on a data container\ninstead of having named volumes but I do not know of a way to leverage this from\nwithin rancher as --volumes-from requires a sidekick relationship there.\n\n## Usage\nThe container knows the following commands. Starting the container without a\ncommand will prompt the container to print its usage information.\n\n- backup\n  Use xtrabackup to create a backup to /target/YY-mm-dd-HH\\_ii\n  - Set environment variable `BACKUP_MODE=FULL` to create a backup to /target/full-YY-mm-dd-HH\\_ii and do not prepare it\n  - Set environment variable `BACKUP_MODE=INCREMENTAL` to create an incremental backup based on the latest full backup found to\n    /target/full-FULL_BACKUP_TIMESTAMP-inc-YY-mm-dd-HH\\_ii\n- restore BACKUP\n  Attempts to restore the given BACKUP from /target/BACKUP\n  - If the regex `^full-.*-inc-.*` matches the backup name it is treated as incremental backup and the full backup\n    included in its name is restored before the incremental one.\n- clear\n  Clears the backup directory in preparation for restoring a backup. This is\n  separate from restore to allow this command to run on all hosts of a galera\n  cluster\n- run COMMAND\n  Run the given command within the container\n- cleanup\n  Remove the full backup 4 weeks older than the last one\n- remove BACKUP\n  Remove the given full backup, its incremental childs and their respective restore services\n- help\n  Print Usage\n\n### backup\n\n| Environment variable | xtrabackup parameter | defaults to |\n| -------------------- | ------------------- | ----------- |\n| MYSQL\\_HOST | --host $PARAM | target |\n| MYSQL\\_PORT | --port $PARAM | 3306 |\n| MYSQL\\_USER | --user $PARAM | - |\n| MYSQL\\_PASSWORD | --password $PARAM | - |\n\nCurrent behavious is to prepare the backup fully aftyer creating it. This will\nprobably change in the future as we start implementing incremental backups and\npreparing on utility servers.\n\n### restore\n\n### clear\nClean the mysql database data via `rm -Rf /var/lib/mysql/*`.  \nThis is intended to be used with `run on all hosts` and scheduling rule `must\nhave service DBSTACK/NEWDBSERVICE` to prepare the new database cluster to receive\nthe backup\n\n### run COMMAND\nRuns the given command as command line within the containers. This is intended\nto debug the container.\n\n### help\nPrints usage.  \nCurrently only prints the full overview.\n\nhelp [COMMAND] might be included in the future if the need arises\n\n## Example\n- Step 1: Create backup from existing data which is not within  \n\t\n\t```sh\n\tdocker volume create --driver=convoy --name=backup\n\tdocker run -it --volumes-from DB_DATA_VOLUME_CONTAINER -v backup:/target --link DB_SERVER_CONTAINER:target -e MYSQL\\_PORT=3306 -e MYSQL\\_USER=root -e MYSQL_PASSWORD='PASSWORD' ipunktbs/xtrabackup\n\t```\n\t\n- Step 2: Create new PXC cluster from Rancher Catalog\n- Step 3: Upgrade PXC service to match your scheduling needs\n- Step 4: Stop PXC service\n- Step 5: Create ipunktbs/xtrabackup service with\n  - Command: clear\n  - Scheduling: All hosts, must have service DBSTACK/DBSERVICE\n  - Volumes: PXC\\_NAMED\\_MYSQL\\_VOLUME:/var/lib/mysql\n- Step 6: Delete the clear service after all instances have successfully finished\n- Step 7: Create ipunktbs/xtrabackup service with\n  - Command: restore\n  - Scheduling: Scale 1, must have service DBSTACK/DBSERVICE\n  - Volumes: PXC\\_NAMED\\_MYSQL\\_VOLUME:/var/lib/mysql, backup:/target\n  - Note: You might have to do this using rancher-compose until per-volume driver is available in rancher, or create the `backup` volume with a driver on all hosts\n- Step 8: Start the pxc server on the server where the `restore` container ran\n  and run the command `SET GLOBAL wsrep_provider_options=\"pc.bootstrap=1\";` to\n  make it the new master.\n- Step 9: Start the other pxc servers and wait for the state sync\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipunkt%2Fdocker-xtrabackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipunkt%2Fdocker-xtrabackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipunkt%2Fdocker-xtrabackup/lists"}