Database backup

maxthebuilder

Joined: 2005-09-15
Posts: 3
Posted: Thu, 2005-09-15 18:27

Hi All,
I am new to this SQL stuff..
Could someone please enlighten me on how reliable this thing is?
I mean, in G1 I could just back up the _albums_ directory and move it to another server - the almums/database were easily backupable/moveable.
Now, I know how to back it up in principle (my web-host allows to download/upload it) but what happens if I move to some other hosting company? I guess, if the new server runs the MySQL - there shouldn't be any prob. But what if they have another database implementation? Or if in a few years MySQL goes to version 23 - will they be compatible with my backups?
Any comments on this would be appreciated greatly.
TIA

max

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-15 18:39

FAQ: How can I move my gallery installation from one server to another?

backing up g2 = backup the db and the g2data folder.
right, you can only move from mysql to mysql.
your photos and albums are still stored in g2data/albums, only metadata (users, titles, ...) are stored in the db.

 
maxthebuilder

Joined: 2005-09-15
Posts: 3
Posted: Fri, 2005-09-16 08:59

Thanks!
BTW, what is the right way to back up the g2data folder? I tried to tar it from the server side - it gave me a bunch of errors saying that a lot of files (most of them in the _cach_ directory failed to go to the archive..

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-16 09:02

tar always worked for me
tar -czf g2data.tar.gz g2data

 
hgpuke

Joined: 2004-04-18
Posts: 10
Posted: Fri, 2005-09-16 12:44

Actually the files in the g2data directory are all owned by the web-server. Some of them (g2data/cache/derivative/*/*/*.dat) are protected 600, so these can't be read by anyone else but the webserver identity! I have a script that uses rsync to automatically backup all changes to my gallery (and other parts of my website) every night. With G2 that script fails on these files. Are these files not essential, can they be skipped, or should I raise a bug-report on this?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-09-16 13:35

first things first:
it's certainly not a bug because g2 still works as expected. just because your script doesn't work, it's not a bug.

about your script / problem:
you could use a php script to generate a tar ball, e.g.
<?php system('tar -czf /path/to/backupDir/g2data.tar.gz /path/to/g2data/'); ?>

which creates a backup with the webserver user. such a script can be called with cron too, e.g. in a password protected dir. "wget http://user:password@host.com/_924bsD92/backup.php"
my webhost offers a cpanel backup solution.
users who have their own server can do more advanced / easier stuff.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2005-09-16 14:16

You might also want to look at setting the permissions G2 sets on files it creates so you can read them as well. For instance 755 for directories and 644 for files. That's in the Site Admin > General section.

 
hgpuke

Joined: 2004-04-18
Posts: 10
Posted: Sun, 2005-10-09 20:35

Great! Thanks! Although when I look at the General page in the Admin view, the default settings are already 755 for directories and 644 for files. Despite this, some files are created 600 as I mentioned in my previous posting. So it looks like I will have to create that php-script to make the tar-file as the web-user identity. (But I still don't understand why it is necessary for Gallery 2 to create these files with 600).

//hgpuke

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2005-10-10 13:18

It could be that your host is forcing this and that gallery actually has no control. I'm pretty sure that all of my G2 files are created with the perms specified in G2's configuration.

Signature: Like Gallery? Appreciate my help? Think I'm an asshole? Make your point by donating to the Gallery project! Or maybe just visit my website.