noinput

  • Ping Me
  • Archive
  • RSS
  • Ask me anything

MySQL Backups on Cloud Sites

I’ve been working with The Rackspace Cloud hosting for some time now, actually since back when it was Mosso. Where I absolutely love the service, the platform and the scalability, the lack of SSH really hurts at times when I need to work on Cloud Sites vs Cloud Servers.  Mostly it’s the times when I need to move, copy, backup large DB’s. After some trial and error I wrote some simple PHP code to handle 2 common tasks I find myself doing.  Those are Backing up and Transferring/copying databases for testing between sites.

Backups
If you just want to make a quick timestamped backup, tar it and store it in your account for reference (or further action) this works great:

$result = shell_exec('FILE=`date +%y-%m-%d_%H-%M`;cd /mnt/stor.../domain/web/; mysqldump --opt --single-transaction -h hostname -u username --password="password" database_name > $FILE.sql; tar czpf $FILE.tar $FILE.sql; rm -f $FILE.sql;');

That will create a database dump, store it in your /web folder tar it up and remove the .sql temp file.

—

Transfers
Additionally if you need to take a development database and move it to your live database (or pull one back, etc), the following code work great for me.

$result = shell_exec('cd /mnt/stor.../domain/web/;mysqldump --opt --single-transaction -h hostname1 -u username1 --password="password1" database_name1 > TRANSFER.sql; mysql -h hostname2 -u username2 --password="password2" database_name2 < TRANSFER.sql;'); 

This will connect to your source database and create a TRANSFER.sql file in your /web folder, then connect to your destination database and do a full insert. the —opt —single-transaction makes this go really smooth and fast. *note, that this assumes you already have your destination database created.  this code does not create the database for you, nor does it auto-delete the transfer.sql file.  However using a bit of the code from the backup line above im sure you could figure that much out with not too much work.

Happy databasing.

    • #rackspace
    • #cloud sites
    • #mysql
    • #backups
    • #geek
  • 1 year ago
  • 7
  • Comments
  • Permalink
  • Share
    Tweet

Squeeze for Snow Leopard

Squeeze for osxI’ve got to say, at first when I installed Squeeze for mac I didn’t expect much, but after month or two of it running in the background, I can’t believe it’s saving me almost 35GB (and climbing) of space.  Apple would be completely ignorant not to buy this company outright and offer this as a native part of OSX.

The best part is that there is zero degradation of performance, speed or file issues I’ve come across. I’m really impressed and super happy it came my way via MacHeist. Anyone else out there using or like it?

    • #osx
    • #squeeze
    • #application
    • #geek
  • 2 years ago
  • 7
  • Comments
  • Permalink
  • Share
    Tweet
juliasegal:

robokachinder:Qué idea más barata y más cojonuda, me ha encantado.

livercake:DaVinci-class brilliance.

puatron:imanel:Ludomatic (via mugwumpian)
Pop-upView Separately

juliasegal:

robokachinder:Qué idea más barata y más cojonuda, me ha encantado.

livercake:DaVinci-class brilliance.

puatron:imanel:Ludomatic (via mugwumpian)

    • #gtd
    • #geek
  • 2 years ago > mxvltr
  • 1725
  • Comments
  • Permalink
  • Share
    Tweet

About

Avatar I talk about things on the internets. Also the developer of tumtumapp.com (Free iPad client for Tumblr).

Me, Elsewhere

  • @noinput on Twitter
  • Facebook Profile
  • noinput on Vimeo
  • noinput on Youtube
  • noinput on Flickr
  • noinput on Delicious
  • noinput on Pinboard
  • noinput on Digg
  • noinput on Foursquare
  • Google
  • Linkedin Profile
  • noinput on github

Tweet Tweet

loading tweets…

Following

I Dig These Posts

  • Photo via imgfave
    Photo via imgfave
  • Photo via imgfave
    Photo via imgfave
  • Post via nfarina
    Git Is Simpler Than You Think

    It was about one year ago that we switched to Git. Previously, we used Subversion, through the Mac app Versions,...

    Post via nfarina
  • Post via chriseidhof
    "I've got an idea for an app"

    I’ve been an iPhone developer for over three years now. The first app I built was CookieCombo. We sold enough copies to...

    Post via chriseidhof
See more →
  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr