<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Backing up your MySQL database to S3</title>
	<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/</link>
	<description>Software Developer</description>
	<pubDate>Thu, 11 Mar 2010 21:19:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Julien</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-47837</link>
		<dc:creator>Julien</dc:creator>
		<pubDate>Wed, 23 Sep 2009 18:17:18 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-47837</guid>
		<description>Awesome! I've been looking for that...
Just one little question though : I have a Master  Master replication. Is there any chance that this breaks the replication? (I am thinking that flushing the logs might be bad). If so, is there any solution to that?</description>
		<content:encoded><![CDATA[<p>Awesome! I&#8217;ve been looking for that&#8230;<br />
Just one little question though : I have a Master  Master replication. Is there any chance that this breaks the replication? (I am thinking that flushing the logs might be bad). If so, is there any solution to that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeevan</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-46788</link>
		<dc:creator>Jeevan</dc:creator>
		<pubDate>Tue, 25 Aug 2009 11:52:34 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-46788</guid>
		<description>Nice article.

shell script option http://chetanjm.wordpress.com/2009/07/16/simple-s3-backup-database-and-code-script-using-s3cmd/</description>
		<content:encoded><![CDATA[<p>Nice article.</p>
<p>shell script option <a href="http://chetanjm.wordpress.com/2009/07/16/simple-s3-backup-database-and-code-script-using-s3cmd/" rel="nofollow">http://chetanjm.wordpress.com/2009/07/16/simple-s3-backup-database-and-code-script-using-s3cmd/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eliot Sykes</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45915</link>
		<dc:creator>Eliot Sykes</dc:creator>
		<pubDate>Tue, 28 Jul 2009 08:19:02 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45915</guid>
		<description>That should be two hypens before the databases option, not a single long dash, "- -" without the space between.</description>
		<content:encoded><![CDATA[<p>That should be two hypens before the databases option, not a single long dash, &#8220;- -&#8221; without the space between.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eliot Sykes</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45914</link>
		<dc:creator>Eliot Sykes</dc:creator>
		<pubDate>Tue, 28 Jul 2009 08:18:04 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45914</guid>
		<description>mysqldump also takes a --databases option which lets you name each database to dump.  For 3 databases named db_name1, db_name2, and db_name3:

mysqldump --databases db_name1 db_name2 db_name3</description>
		<content:encoded><![CDATA[<p>mysqldump also takes a &#8211;databases option which lets you name each database to dump.  For 3 databases named db_name1, db_name2, and db_name3:</p>
<p>mysqldump &#8211;databases db_name1 db_name2 db_name3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Dowman</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45462</link>
		<dc:creator>Paul Dowman</dc:creator>
		<pubDate>Mon, 13 Jul 2009 12:03:43 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45462</guid>
		<description>That's correct, this will just do a single database, but I think it would be a pretty simple change to do multiple databases. Check the documentation for the mysqldump command, I think it can take an "--all-databases" parameter.</description>
		<content:encoded><![CDATA[<p>That&#8217;s correct, this will just do a single database, but I think it would be a pretty simple change to do multiple databases. Check the documentation for the mysqldump command, I think it can take an &#8220;&#8211;all-databases&#8221; parameter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45443</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Mon, 13 Jul 2009 02:58:09 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45443</guid>
		<description>Hi Paul,

Thanks for your useful script first,but I have a question with it
See:
@mysql_database = "your-mysql-database"

Is it means that you can only backup a single database with this script?

If I want to backup all the databases,what should I change with your script?

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Paul,</p>
<p>Thanks for your useful script first,but I have a question with it<br />
See:<br />
@mysql_database = &#8220;your-mysql-database&#8221;</p>
<p>Is it means that you can only backup a single database with this script?</p>
<p>If I want to backup all the databases,what should I change with your script?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Dowman</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45386</link>
		<dc:creator>Paul Dowman</dc:creator>
		<pubDate>Sat, 11 Jul 2009 11:32:23 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45386</guid>
		<description>I've been meaning to make it into a RubyGem, but haven't had time.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been meaning to make it into a RubyGem, but haven&#8217;t had time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Primerano</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45322</link>
		<dc:creator>Tony Primerano</dc:creator>
		<pubDate>Fri, 10 Jul 2009 00:19:44 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45322</guid>
		<description>By “log_bin only” I mean that I didn't specify a path 
Instead of 
log_bin = /var/db/mysql/binlog/mysql-bin
I just have
log_bin

This resulted in the path and filename being different.

Thanks for the code.  This is was a great starting point.  Is the updated code available outside of installing ec2onrails?  I recently moved off AWS and I now use Mosso for everything.</description>
		<content:encoded><![CDATA[<p>By “log_bin only” I mean that I didn&#8217;t specify a path<br />
Instead of<br />
log_bin = /var/db/mysql/binlog/mysql-bin<br />
I just have<br />
log_bin</p>
<p>This resulted in the path and filename being different.</p>
<p>Thanks for the code.  This is was a great starting point.  Is the updated code available outside of installing ec2onrails?  I recently moved off AWS and I now use Mosso for everything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Dowman</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45210</link>
		<dc:creator>Paul Dowman</dc:creator>
		<pubDate>Mon, 06 Jul 2009 17:43:56 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45210</guid>
		<description>Tony:

Thanks for pointing out that the full backup should delete the binary logs. That's a bug, I'll try to find time to fix it.

You're right, when any of the S3 calls fail we should retry. I recently switched the backup feature in EC2 on Rails (which this example code is based on) to use the right_aws S3 library instead of aws/s3 because it automatically retries a few times with an increasing pause between failures.

Regarding the other issues: I look at this as just mirroring the MySQL data on S3, not archiving it. If you screw up your database in any way then as you pointed out you'll be backing up your screwed up version. I think it's a good idea to archive it as well, and I archive mine regularly (but to a different S3 bucket entirely).

I'm not sure what you mean about having "log_bin only".</description>
		<content:encoded><![CDATA[<p>Tony:</p>
<p>Thanks for pointing out that the full backup should delete the binary logs. That&#8217;s a bug, I&#8217;ll try to find time to fix it.</p>
<p>You&#8217;re right, when any of the S3 calls fail we should retry. I recently switched the backup feature in EC2 on Rails (which this example code is based on) to use the right_aws S3 library instead of aws/s3 because it automatically retries a few times with an increasing pause between failures.</p>
<p>Regarding the other issues: I look at this as just mirroring the MySQL data on S3, not archiving it. If you screw up your database in any way then as you pointed out you&#8217;ll be backing up your screwed up version. I think it&#8217;s a good idea to archive it as well, and I archive mine regularly (but to a different S3 bucket entirely).</p>
<p>I&#8217;m not sure what you mean about having &#8220;log_bin only&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Primerano</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45002</link>
		<dc:creator>Tony Primerano</dc:creator>
		<pubDate>Tue, 30 Jun 2009 20:59:49 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-45002</guid>
		<description>Some notes.  

In my.cnf I had log_bin only which results in the binary logs being named mysqld.bin thus I needed to edit incremental_backup.rb and restore.rb

I was concerned that there was only one full backup in s3.  Isn't it possible for my DB to be damaged and then overwrite the good copy in s3?  Assuming the dump is done daily I moved the last dumpfile before pushing the latest one.  

last_dump =  File.basename(dump_file) + (Date.today-1).wday.to_s
# allows for 7 days of dumps to be in S3
begin
  AWS::S3::S3Object.rename(File.basename(dump_file), last_dump,  @s3_bucket)
rescue AWS::S3::NoSuchKey
  puts last_dump + " did not exist.  continuing"
end


If someone accidentally deleted the database before the full backup would we push an empty dump file?    Just in case I also check the size of the dump and only push to s3 if the size is greater than an arbitrary 1000 bytes

I also added code to remove the binary logs from S3 on full backup..  I have not added locking yet to prevent the scripts from overlapping..  Any reason why you didn't share the whole solution?  :-)

Another question:  what happens if AWS::S3::S3Object.store fails.  Seems like that would be grounds for a retry.  (another reason why I like having 7 days of backups in s3.  hopefully one is good.  )</description>
		<content:encoded><![CDATA[<p>Some notes.  </p>
<p>In my.cnf I had log_bin only which results in the binary logs being named mysqld.bin thus I needed to edit incremental_backup.rb and restore.rb</p>
<p>I was concerned that there was only one full backup in s3.  Isn&#8217;t it possible for my DB to be damaged and then overwrite the good copy in s3?  Assuming the dump is done daily I moved the last dumpfile before pushing the latest one.  </p>
<p>last_dump =  File.basename(dump_file) + (Date.today-1).wday.to_s<br />
# allows for 7 days of dumps to be in S3<br />
begin<br />
  AWS::S3::S3Object.rename(File.basename(dump_file), last_dump,  @s3_bucket)<br />
rescue AWS::S3::NoSuchKey<br />
  puts last_dump + &#8221; did not exist.  continuing&#8221;<br />
end</p>
<p>If someone accidentally deleted the database before the full backup would we push an empty dump file?    Just in case I also check the size of the dump and only push to s3 if the size is greater than an arbitrary 1000 bytes</p>
<p>I also added code to remove the binary logs from S3 on full backup..  I have not added locking yet to prevent the scripts from overlapping..  Any reason why you didn&#8217;t share the whole solution?  :-)</p>
<p>Another question:  what happens if AWS::S3::S3Object.store fails.  Seems like that would be grounds for a retry.  (another reason why I like having 7 days of backups in s3.  hopefully one is good.  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xavier Shay</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-31651</link>
		<dc:creator>Xavier Shay</dc:creator>
		<pubDate>Sat, 07 Mar 2009 03:31:18 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-31651</guid>
		<description>I've used this code as a base for a rails plugin that provides rake tasks: http://github.com/xaviershay/db2s3/tree/master

Major differences are using ruby's Tempfile rather than managing your own temp dir, externalizing config so you can store it safely in source control, and some specs to make sure it all works.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used this code as a base for a rails plugin that provides rake tasks: <a href="http://github.com/xaviershay/db2s3/tree/master" rel="nofollow">http://github.com/xaviershay/db2s3/tree/master</a></p>
<p>Major differences are using ruby&#8217;s Tempfile rather than managing your own temp dir, externalizing config so you can store it safely in source control, and some specs to make sure it all works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marston A.</title>
		<link>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-25247</link>
		<dc:creator>Marston A.</dc:creator>
		<pubDate>Wed, 18 Feb 2009 18:09:41 +0000</pubDate>
		<guid>http://pauldowman.com/2009/02/08/mysql-s3-backup/#comment-25247</guid>
		<description>Hey Paul,

Great article. I'm wondering how easy/hard it would be to roll encryption into this (PGP, maybe openssl etc) to encrypt the tar dumps before putting them on S3.</description>
		<content:encoded><![CDATA[<p>Hey Paul,</p>
<p>Great article. I&#8217;m wondering how easy/hard it would be to roll encryption into this (PGP, maybe openssl etc) to encrypt the tar dumps before putting them on S3.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
