{"id":18594617,"url":"https://github.com/kuluce/mysql-5.7-backup-restore","last_synced_at":"2025-05-16T11:33:33.340Z","repository":{"id":249771781,"uuid":"832503837","full_name":"kuluce/mysql-5.7-backup-restore","owner":"kuluce","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-23T07:04:14.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T22:46:28.445Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuluce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-23T06:50:37.000Z","updated_at":"2024-11-25T08:29:46.000Z","dependencies_parsed_at":"2024-07-23T09:09:16.861Z","dependency_job_id":null,"html_url":"https://github.com/kuluce/mysql-5.7-backup-restore","commit_stats":null,"previous_names":["kuluce/mysql-5.7-backup-restore"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuluce%2Fmysql-5.7-backup-restore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuluce%2Fmysql-5.7-backup-restore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuluce%2Fmysql-5.7-backup-restore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuluce%2Fmysql-5.7-backup-restore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuluce","download_url":"https://codeload.github.com/kuluce/mysql-5.7-backup-restore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254523063,"owners_count":22085280,"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-11-07T01:16:24.104Z","updated_at":"2025-05-16T11:33:33.315Z","avatar_url":"https://github.com/kuluce.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MySQL 5.7 Backup and Restore\n\nThis repository provides a comprehensive solution for automating the backup and restore processes of MySQL 5.7 databases using Docker. The scripts included offer full and incremental backup capabilities, as well as the ability to manage historical backups.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Setup](#setup)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n- [Usage](#usage)\n  - [Backup](#backup)\n  - [Restore](#restore)\n- [Backup Strategy](#backup-strategy)\n- [License](#license)\n\n## Overview\n\nThis project aims to automate the backup and restore operations for MySQL 5.7 databases deployed in Docker containers. It includes scripts for:\n- Full backups\n- Incremental backups\n- Historical backup management\n- Automated restore processes\n\n## Features\n\n- **Full Backup**: Performed weekly to ensure a complete snapshot of the database.\n- **Incremental Backup**: Performed daily to capture changes since the last full backup.\n- **Historical Backup Management**: Automatically archives and compresses old backups, retaining the last 30 cycles.\n- **Automated Restore**: Simplified scripts to restore databases from full and incremental backups.\n\n## Setup\n\n### Prerequisites\n\n- Docker\n- MySQL 5.7\n- `xtrabackup` installed on the MySQL container\n- Proper configuration of MySQL user permissions\n\n### Installation\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/kuluce/mysql-5.7-backup-restore.git\n   cd mysql-5.7-backup-restore\n   ```\n\n2. Ensure your MySQL containers are configured correctly and accessible.\n\n## Usage\n\n### Backup\n\nThe backup process can be executed using the provided `backup_database.sh` script. It supports full and incremental backups based on the day of the week.\n\n#### Running a Backup\n\nTo schedule the backup script via cron, add the following entry to your crontab:\n```bash\n10 0 * * * /bin/bash /path/to/backup_database.sh backup\n```\n\nThis will run the backup script at 00:10 every day.\n\n### Restore\n\nThe restore process can be executed using the provided `restore_database.sh` script. It supports restoring from full and incremental backups.\n\n#### Running a Restore\n\n1. To restore a full backup:\n   ```bash\n   /bin/bash /path/to/restore_database.sh full \u003cbackup_id\u003e\n   ```\n\n2. To restore an incremental backup:\n   ```bash\n   /bin/bash /path/to/restore_database.sh inc \u003cbackup_id\u003e\n   ```\n\n## Backup Strategy\n\nThe backup strategy implemented in this repository follows these principles:\n\n- **Weekly Full Backups**: Performed every Saturday.\n- **Daily Incremental Backups**: Performed every day except Saturday.\n- **Historical Backup Management**: Archives and compresses the previous week's full and incremental backups every Saturday, retaining the last 30 cycles.\n\n### Backup Script Details\n\nThe `backup_database.sh` script:\n- Checks the day of the week and performs the appropriate backup (full or incremental).\n- Archives and moves the previous week's backups to a historical directory.\n- Logs all operations for troubleshooting and auditing purposes.\n\n### Restore Script Details\n\nThe `restore_database.sh` script:\n- Handles both full and incremental restores.\n- Ensures the target database is stopped before performing the restore.\n- Logs all operations for troubleshooting and auditing purposes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n```\n\nThis README file provides a comprehensive overview of the project, instructions for setup and usage, and details about the backup strategy. It is designed to be clear and informative for users who want to implement and use the backup and restore scripts provided in the repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuluce%2Fmysql-5.7-backup-restore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuluce%2Fmysql-5.7-backup-restore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuluce%2Fmysql-5.7-backup-restore/lists"}