[HOWTO] Make automatic backup of ALL MySQL databases

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Mon Aug 24, 2009 7:57 pm

The find command can take quite a lot of time, so it's not viable to run it every time the backup is to be done.
But there might be another way, look in your pm
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Mon Aug 24, 2009 9:04 pm

ok, i should have thought about the time needed at every launch :oops:
PM answered
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Tue Aug 25, 2009 1:12 am

Hi jm45

Thanks for the feedback, it is much appreciated, the script is updated again, please note the change in the archive name of old backups.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Tue Aug 25, 2009 1:30 am

everything is fine, nothing to change in the script,

every paths are well found.
nice job
:D
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Tue Aug 25, 2009 2:01 am

now:
once the backup is done, i get files.sql as
(example with the database of my forum )

/share/HDA_DATA/Qbackup/mysql/forum.sql

then what to do with this file if i wish to restore ?

a cp should no fit ...

hence /share/HDA_DATA/.@mysql/forum/ contains a lot of files like x.frm x.MYD x.MYI
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Tue Aug 25, 2009 3:11 am

You are absolutely right.
The restore procedure was a relick of previous methods to do backup.
You import the database via phpMyAdmin, the procedure has been updated.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Tue Aug 25, 2009 3:23 am

brillant! fribse.
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Wed Aug 26, 2009 6:16 pm

I updated the script to a bit better error handling, and also cleaned up the code a bit.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Wed Aug 26, 2009 6:26 pm

latest v1.8 tested,
all working fine :D

just a cosmetic about output log:
maybe it would be usefull to change text, and remind the full path for oldmysql folder
changing:
"Compressing old backup to 090826.tar.gz"
..
"Done compressing old backup"
as
Compressing previous backup to /share/HDA_DATA/Qbackup/oldmysql/090826.tar.gz
..
Done compressing previous backup

-------------------------------------------------------------------------------------
Cleaning out old backups. Keeping the last 15 backups

Compressing old backup to 090826.tar.gz

/share/HDA_DATA/Qbackup/mysql/
/share/HDA_DATA/Qbackup/mysql/mysql.sql
/share/HDA_DATA/Qbackup/mysql/test.sql
/share/HDA_DATA/Qbackup/mysql/forum.sql

Done compressing old backup

Backing up current databases

Backing up MySQL database mysql
Backing up MySQL database test
Backing up MySQL database forum

All databases backed up


#
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby bramschats » Wed Sep 09, 2009 10:35 pm

Hello,

I have installed the script as discribed but since it all is nearly out of my league i have a few questions.
1. how can manually start the script to see if the backup is working?
2. how can i see in the eventlog or something if everything is backed up correctly?

I use wordpress and i need to backup the databases!

Hope someone can help me with this one.
Qnap TS-459pro II | Qnap TS-239pro | HDI Dune prime 3.0 |
bramschats
Easy as a breeze
 
Posts: 396
Joined: Thu Apr 23, 2009 1:51 am
NAS Model: TS-259 Pro+

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Wed Sep 09, 2009 11:04 pm

No entry in the eventlog.

But you can run it from a SSH session, like any other command.

Log in with Putty username admin and your admin password.
type the full path, and commandname (including .sh), and it will show what happens on the screen, and also give errors out.
If you see .sql files in the share you have chosen to backup to (under the mysql folder), then the backup is running.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby bramschats » Thu Sep 10, 2009 1:00 am

What is wrong if i am getting the following message.


I think i have done everything right.

Code: Select all
[~] # /opt/bin/mysqlbackup.sh
ERROR mysqldump command not found. Please use the command 'find / -name mysqldump' and send the result to the author


Code: Select all
[~] # find / -name mysqldump
/mnt/ext/opt/mysql/bin/mysqldump


what do i have to do to solve this.....

One other thing i do not understand:
"Create the mysqlbackup.sh file with pspad.exe on one of your normal shares"

thanks in advance.
Qnap TS-459pro II | Qnap TS-239pro | HDI Dune prime 3.0 |
bramschats
Easy as a breeze
 
Posts: 396
Joined: Thu Apr 23, 2009 1:51 am
NAS Model: TS-259 Pro+

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Thu Sep 10, 2009 1:44 am

Answered in PM
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby fribse » Wed Sep 16, 2009 2:05 pm

The script was updated to take care of the TS-219 without raid, and it will also create the dir's under the share itself now, including some error checking.
Best regards
Fribse

NO, RAID is NOT backup - Use RAID-Certified 24x7 drives for raid
HOWTO's:
Make automatic backup of ALL MySQL databases http://forum.qnap.com/viewtopic.php?f=32&t=15628
Make your own Apache config with multisites http://forum.qnap.com/viewtopic.php?f=32&t=14450
Beaf up security on Apache with customized.conf http://forum.qnap.com/viewtopic.php?f=32&t=15540

NAS TS-659 Pro w. 4x 1TB WD Caviar Black | Joomla, MySQL | TS-119 w. 1x 2TB | VioStor VS101P
SERVERS VMWare 4.0.2 | OES2sp3 GroupWise 2012 | PS3 60GB (upgraded to 500 GB) | X-Box 360 Elite | Nintendo Wii | Revo Pico RadioStation | ACryan PlayOnHD Mini | 3 Windows 7 Ent PC's
NET FritzBox 7390 | HP Procurve 1800-24G | Linksys WAP200
User avatar
fribse
Experience counts
 
Posts: 1762
Joined: Mon Feb 11, 2008 2:50 am
Location: Greve, Denmark
NAS Model: TS-509 Pro

Re: [HOWTO] Make automatic backup of ALL MySQL databases

Postby jm45 » Wed Sep 16, 2009 4:41 pm

Hi,
V2.0 tested ok
on my TS-109 II firmware version: 3.1.0 Build 0708T

Backup Successfull :)
TS-109 II firmware version: 3.1.0 Build 0708T (1TB disk)
jm45
Easy as a breeze
 
Posts: 411
Joined: Tue Oct 07, 2008 6:30 pm
NAS Model: TS-109/209 Pro II

PreviousNext

Return to Web Server & Applications (Apache + PHP + MySQL / SQLite)

Who is online

Users browsing this forum: No registered users and 1 guest