The FreeBSD Diary

The FreeBSD Diary (TM) Remember
I remember
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 MySQL? XML? mysqldump?
Author: Dan 
Date:   27-09-06 18:32

Have you been backing up MySQL using the --xml option? Do you now have a backup you can't use? I figured out how to extract the data from the XML file.

Contact me if you need help. I can reclaim the data for you.

--
Webmaster

Reply To This Message
 
 Re: MySQL? XML? mysqldump?
Author: csinclair 
Date:   21-11-06 16:40

Hi Dan,
I have been backing up a mediawiki server for several months using the mysqldump option, (see code example 1). I'm afraid of re-importing the data when I need to, (due to box migration or crash, either of which should be coming soon). I'd love to hear your thoughts on how to make this easier, maybe scripting the entire process in 2 parts (Export/Import).

<code snippet>

#!/bin/csh
#www/data backup
tar -cf - /usr/local/www/data-dist/* | gzip -c > ~/bak/$1_www_data.tar.gz
#mysql db backup
sqldump --user=root --password=******** wikidb > ~/bak/$1.mysql.dump
tar -cf - ~/bak/$1.mysql.dump | gzip -c > ~/bak/$1_mysql_dump.tar.gz
rm ~/bal/$1.mysql.dump

</code snippet>
As you can clearly see I'm not using the xml option, I would if I thought it would be helpful, please explain.
Also, what about all of my graphic images on the server as well, I've been tar.gz'ing them with the script as well, but I'm not too sure how the images will fare in the tarring/untarring as well as how to automate or ease the transition when moving the Wiki database, pictures and all.
Any tips or pointers on this topic are appreciated as I'll have to use this soon in the real world.

Use the source Luke...

Post Edited (21-11-06 11:41)

Reply To This Message
 
 Re: MySQL? XML? mysqldump?
Author: Dan 
Date:   21-11-06 16:55

Do not use the XML option.

--
Webmaster

Reply To This Message
 
 Re: MySQL? XML? mysqldump?
Author: Dan 
Date:   21-11-06 16:59

csinclair wrote:

> <code snippet>
>
> #!/bin/csh
> #www/data backup
> tar -cf - /usr/local/www/data-dist/* | gzip -c >
> ~/bak/$1_www_data.tar.gz

What is this backing up? The websites? OK.

> #mysql db backup
> sqldump --user=root --password=******** wikidb >
> ~/bak/$1.mysql.dump



> tar -cf - ~/bak/$1.mysql.dump | gzip -c >
> ~/bak/$1_mysql_dump.tar.gz
> rm ~/bal/$1.mysql.dump

>
> </code snippet>

> As you can clearly see I'm not using the xml option, I would
> if I thought it would be helpful, please explain.
> Also, what about all of my graphic images on the server as
> well, I've been tar.gz'ing them with the script as well, but
> I'm not too sure how the images will fare in the
> tarring/untarring as well as how to automate or ease the
> transition when moving the Wiki database, pictures and all.
> Any tips or pointers on this topic are appreciated as I'll
> have to use this soon in the real world.

Have you tested it? Reverse the process and import the data you backed up. Test it.

--
Webmaster

Reply To This Message
 
 Re: MySQL? XML? mysqldump?
Author: csinclair 
Date:   23-11-06 01:11

OK,
I have a 2nd box set up the same for just such a test, problem is, deciding on command to use to import as easily and efficiently as possible. I've been meaning to get around to it for a while, I have a few examples to use as reference but just don't have the exact details worked out yet.
Any suggestions are appreciated.

Use the source Luke...

Reply To This Message
 
 Re: MySQL? XML? mysqldump?
Author: Dan 
Date:   23-11-06 01:21

Get it working first. Then worry about efficiency.

> tar -cf - ~/bak/$1.mysql.dump | gzip -c >
> ~/bak/$1_mysql_dump.tar.gz

This will do pretty much the same thing:

tar -czf ~/bak/$1_mysql_dump.tar.gz ~/bak/$1.mysql.dump

Just as easy....

then to reverse it:

tar -xzf ~/bak/$1_mysql_dump.tar.gz

and mysql -u USER DATABSE < ~/bak/$1.mysql.dump

Or something like that.

--
Webmaster

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org