Skip to main content

Upload Mydumper directories to S3.

Project description

Mydumper To S3

Action

A tool that can upload mydumper dumped files to S3 bucket.

It works even while mydumper is running, for mydumper opened files, mydumper2s3 will wait mydumper to close those files then upload. --delete-after-upload option enables you to backup your MySQL without dumping all of your data to local disk.

It works like this:


+-----------+
|  mydumper |
+-----+-----+
      |
      |
      v
+-----+------+  upload  +-------------+      +------+
| local disk +----------> mydumper2s3 +------>  s3  |
|            <----------+             |      |bucket|
+------------+  delete  +-------------+      +------+
                after
                upload

Install

   pip install mydumper2s3

Usage

Check help:

$ mydumper2s3 --help
Usage: mydumper2s3.py [OPTIONS]

  mydumper2s3: upload mydumper dumped files to s3 bucket. It works even
  while mydumper is running!

Options:
  -a, --access_key TEXT           S3 access_key
  -s, --secret_key TEXT           S3 secret_key
  -d, --domain TEXT               S3 domain
  -b, --bucket TEXT               S3 bucket, if not spcified, a new bucket
                                  named by directory will be created

  -l, --path TEXT
  -i, --check-interval INTEGER
  --ssl / --no-ssl
  -t, --upload-thread INTEGER     thread numbers used to upload to s3
  --delete-after-upload / --no-delete-after-upload
                                  if set to True, files will be deleted in
                                  local space after uploading.

  --help                          Show this message and exit.

Example

Upload files to S3 (If mydumper is running, you can still using this command, mydumper2s3 will search mydumper process pid and watch files opended by mydumper.):

$ mydumper2s3 --domain 127.0.0.1:9000 \
             --bucket test1 \
             --path ~/Downloads/target \
             --access_key AKIAIOSFODNN7EXAMPLE \
             --secret_key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \
             --upload-thread=10
138 files in directory,   0 dumping,   0 uploading,  138 uploaded.
138 files successfully uploaded.

You can check the backup with this command (available in your $PATH after install mydumper2s3):

$ verify-dump --domain 127.0.0.1:9000 \
              --bucket test1 \
              --path ~/Downloads/target \
              --access_key AKIAIOSFODNN7EXAMPLE \
              --secret_key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
All files are exist both on local and on S3, file name check pass...
start verifying file's md5, file count: 138.
(1/138) verifying metadata...pass
(2/138) verifying test-schema-create.sql...pass
(3/138) verifying test.foo_event-schema.sql...pass
(4/138) verifying test.foo_event_alarms-schema.sql...pass
(5/138) verifying test.foo_list-schema.sql...pass
…

Development

Run monio locally

docker run -p 9000:9000 \
  -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \
  -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
  minio/minio server /data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mydumper2s3-0.1.6.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

mydumper2s3-0.1.6-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file mydumper2s3-0.1.6.tar.gz.

File metadata

  • Download URL: mydumper2s3-0.1.6.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.9 Linux/4.15.0-1095-azure

File hashes

Hashes for mydumper2s3-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f2f60c6b442dd6ea51253dd2263788351f27cc1bfddc7532fd98194cf8b76887
MD5 8ec070c25c63599f2b69cd4882b4e351
BLAKE2b-256 538a1ca8069572bf7fcb51c3439e631b7a2225af083da834e213bba13e9408eb

See more details on using hashes here.

File details

Details for the file mydumper2s3-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: mydumper2s3-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.9 Linux/4.15.0-1095-azure

File hashes

Hashes for mydumper2s3-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e935938e4da52418707a21c402b3e5dbfe3c7a8a484e3a89b3919d1a4fc66ae2
MD5 c4f89d77031d1e1976d50bd0109910ca
BLAKE2b-256 3501654a1538ed96b52521225d7b9e63eba1f481179653fea8cd9a30855e9a50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page