Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors Azure Blob Storage destination #458

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Jsalz2000
Copy link

@Jsalz2000 Jsalz2000 commented Aug 31, 2024

Summary

This pull request refactors/adds an Azure Blob Storage implementation for twindb-backup. Removes a majority of the existing code for Azure Blob, as it was overly complex, and wasn't already integrated with the twindb-backup command.

This feature will allow users to backup and restore directly from an Azure Blob Storage Account.

Config

[az]
connection_string = "DefaultEndpointsProtocol=https;AccountName=ACCOUNT_NAME;AccountKey=ACCOUNT_KEY;EndpointSuffix=core.windows.net"
container_name = twindb-backups
remote_path = /backups/mysql # optional

Examples

twindb-backup ls

bash-5.1# twindb-backup ls
2024-09-03 14:41:08,152: INFO: ls.list_available_backups():25: Destination <twindb_backup.destination.az.AZ object at 0xffff8533ec70>
2024-09-03 14:41:09,655: INFO: ls._print_media_type():44: mysql hourly copies:
coolhostname/hourly/mysql/mysql-2024-09-03_14_37_20.xbstream.gz
2024-09-03 14:41:10,922: INFO: ls._print_binlog():52: Binary logs:
coolhostname/binlog/binlog.000001.gz
coolhostname/binlog/binlog.000002.gz
coolhostname/binlog/binlog.000003.gz
coolhostname/binlog/binlog.000004.gz

twindb-backup verify

bash-5.1# twindb-backup verify mysql coolhostname/hourly/mysql/mysql-2024-09-03_14_37_20.xbstream.gz
2024-09-03 14:43:29,295: INFO: restore.restore_from_mysql():320: Restoring MySQLCopy(coolhostname/hourly/mysql/mysql-2024-09-03_14_37_20.xbstream.gz) = {
    "backup_finished": 1725374247,
    "backup_started": 1725374240,

.....

2024-09-03 14:43:36,148: INFO: restore.restore_from_mysql():429: Then you can start MySQL normally.
{
    "backup_copy": "coolhostname/hourly/mysql/mysql-2024-09-03_14_37_20.xbstream.gz",
    "restore_time": 6.85528564453125,
    "success": true
}

Azure Storage Account

Screenshot 2024-09-03 at 9 40 11 AM

Copy link
Contributor

@ernstae ernstae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very complete and I'm excited to kick the tires and test it out. In the short-term, I caught a typo that was already in the documentation codebase that could be fixed.

This, overall looks like complete coverage of the Azure Blob functionality and well-structured Python, James.

docs/usage.rst Outdated Show resolved Hide resolved
twindb_backup/destination/az.py Show resolved Hide resolved
twindb_backup/destination/az.py Outdated Show resolved Hide resolved
@Jsalz2000 Jsalz2000 marked this pull request as ready for review September 3, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants