#s3

Backup Cassandra to S3 SWS

This post is just a small post. I would like to show you a way to incremental backup Cassandra to S3. In my case, I use a opensource named Cassandra_Snapshorter.

To know how to install it in your machine, you can refer to https://github.com/tbarbugli/cassandra_snapshotter

Now, we create a backup script

After that, We will create a job in Crontab to run backup every night.

Backup Postgres 9.4 to S3 with WAL-E in Ubuntu 14.04

If you are using Postgres 9.4 Database for your project. I think that you are thinking about backup Backup Postgres everyday. So in this post I will show you how to  backup Backup Postgres 9.4 to S3.

9efd1a62-cdf7-4a05-8d2f-11e0b44492c8-medium

A sign of a good leader is not how many followers you have, but how many leaders you create.

Install Dependencies:

Using PIP to install WAL-E:

Using PIP to upgrade Request:

Using PIP to upgrade Six:

If you not upgrade them,  maybe you will meet an error as below when you run WAL-E Backup:

And we should change permission for PIP packet so that postgres user is able to use them:

Edit postgresql.conf to do backup with wall-push command:

Now, we restart postgres to apply the changes:

Backup Everyday

Assume that you created a bucket on S3, and you have AWS credentials. So you should push them to config file with commands:

Now, we will try to backup to S3 in the first time. At the first, change to postgres user:

Run backup command:

The output should be:

Finally, we add the command to crontab to backup 5 AM everyday:

Finished your works now!

Upload and Download files from AWS S3 with Python 3

If you are trying to use S3 to store files in your project. I hope that this simple example will be helpful for you.

Install Boto3 via PIP

Please take a look to the source code at https://github.com/thanhson1085/python-s3 before reading this post.

With boto3, It is easy to push file to S3. Please make sure that you had a AWS account and created a bucket in S3 service.

And it is not difficult to save file from S3 to local: