Author Topic: Auto Game Back Up  (Read 734 times)

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Auto Game Back Up
« on: March 07, 2009, 09:44:38 AM »
I've been looking into it before I came here and I didn't find much on goggle.

Auto script that backs up the games DB ever day.

I'd have it run on a cron job so every day at x time all users would be logged out and can't login while the back up takes place and once it has finiished the SQL file will be saved in a folder of my choice with a random name so no one can guess it.  Name such as "15492-Date.sql"

Reason I want todo this is because if theres ever a prob I can just roll the db back 1 day instead of when i last make a backup which would have been months ago.

Any tips on how to do this would be great.

Thanks,
Sean


Offline Scion

  • Level 27
  • **
  • Posts: 402
  • Reputation: +11/-0
    • View Profile
Re: Auto Game Back Up
« Reply #1 on: March 07, 2009, 12:18:16 PM »
you should talk to your hosting company about what support they have for doing hot backups.

a hot backup has the advantage that it doesnt need you to take your db offline at all...so your game / app can stay up.


Offline bbgames

  • Level 16
  • *
  • Posts: 138
  • Reputation: +1/-0
    • View Profile
    • Building Browsergames
Re: Auto Game Back Up
« Reply #2 on: March 07, 2009, 08:55:36 PM »
If you have access to your server to setup a cronjob, you can set up your own hot backups - check out mysqldump for dumping your database(I believe it'll run without having to take down mysql, too).

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: Auto Game Back Up
« Reply #3 on: March 08, 2009, 06:30:01 AM »
Thanks guys :)

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 589
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: Auto Game Back Up
« Reply #4 on: March 08, 2009, 03:53:33 PM »
Someone on PHP-Classes just released a backup script, might want to look there. Though with the script I'm thinking about it basically creates the backup and then uploads it to your computer for offsite storage.

If you have CRON access then I would look at a PERL script. Reason being even on the command line PHP does have a timeout associated with it. Yes you can adjust said timeout but I found that not to be very stable up to version 4 of PHP (maybe 5 is).

Basically what the PERL program does is executes a system call to mysqldump + gzip and puts said backup into a directory that is NOT web accessible. After the backup is made it then looks at the directory, puts the files in an array based on time stamp and if the array is larger then 10 entries it then deletes  the last X filenames in the array. So we have 10 backups in 6 hour increments. You are going to want to have something that deletes those backups after a certain amount of time or you'll fill your hard drive pretty quickly. Don't rely on yourself to delete these, if you go away for a couple days or forget the server doesn't do well when the hard drive is full ;)

try hotscripts.com and look in the PERL section ;)



Creating online addictions, one game at a time:

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: Auto Game Back Up
« Reply #5 on: March 08, 2009, 04:53:16 PM »
Someone on PHP-Classes just released a backup script, might want to look there. Though with the script I'm thinking about it basically creates the backup and then uploads it to your computer for offsite storage.

If you have CRON access then I would look at a PERL script. Reason being even on the command line PHP does have a timeout associated with it. Yes you can adjust said timeout but I found that not to be very stable up to version 4 of PHP (maybe 5 is).

Basically what the PERL program does is executes a system call to mysqldump + gzip and puts said backup into a directory that is NOT web accessible. After the backup is made it then looks at the directory, puts the files in an array based on time stamp and if the array is larger then 10 entries it then deletes  the last X filenames in the array. So we have 10 backups in 6 hour increments. You are going to want to have something that deletes those backups after a certain amount of time or you'll fill your hard drive pretty quickly. Don't rely on yourself to delete these, if you go away for a couple days or forget the server doesn't do well when the hard drive is full ;)

try hotscripts.com and look in the PERL section ;)






Thanks, I'll let you know how it goes

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal