jballiet3
asked on
mysqldump error 2013: lost connection to mysql
Anybody know how to resolve this issue....
/etc/cron.daily/mysqlbacku p:
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `Attachments` at row: 81506
/etc/cron.daily/mysqlbacku
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `Attachments` at row: 81506
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
#!/bin/sh
#
# mysqlbackup
#
# Script to make daily dumps of MySQL database and RT (if installed)
#
BACKUPDIR=/backup/hq/repli cated/mysq l
# Backup MySQL
/usr/bin/mysqldump --single-transaction --quick --all-databases --default-character-set=la tin1
> ${BACKUPDIR}/`hostname`-`d ate +%C%y%m%d`-mysql-all.sql
# Backup RT, if present
if [ -d /usr/local/rt ]; then
tar cf ${BACKUPDIR}/`hostname`-`d ate +%C%y%m%d`-rtconfig.tgz -C /usr/local/rt etc
fi
# Clean out old dumps
find ${BACKUPDIR} -ctime +5 -exec rm {} \;
#
# mysqlbackup
#
# Script to make daily dumps of MySQL database and RT (if installed)
#
BACKUPDIR=/backup/hq/repli
# Backup MySQL
/usr/bin/mysqldump --single-transaction --quick --all-databases --default-character-set=la
> ${BACKUPDIR}/`hostname`-`d
# Backup RT, if present
if [ -d /usr/local/rt ]; then
tar cf ${BACKUPDIR}/`hostname`-`d
fi
# Clean out old dumps
find ${BACKUPDIR} -ctime +5 -exec rm {} \;
ASKER
database size is 32107M
Your database is over 30 gigabytes in size? That would definitely take a while to back up. I would again suggest that you examine the other cron scripts to see what runs. That will help you determine what is causing MySQL to stop while your backup is running.
ASKER
I made an error. The actual database size is 12Gig
The same comment still stands. Your database is 12 GB. Presumably this takes a long time, perhaps hours, to back up. Have you checked your other scheduled tasks to see what may be interfering? I still have not seen you comment on that.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
How would I do this with rsync...
BACKUPDIR=/backup/hq/repli cated/mysq l
# Backup MySQL
/usr/bin/mysqldump --single-transaction --quick --all-databases --default-character-set=la tin1 > ${BACKUPDIR}/`hostname`-`d ate +%C%y%m%d`-mysql
-all.sql
BACKUPDIR=/backup/hq/repli
# Backup MySQL
/usr/bin/mysqldump --single-transaction --quick --all-databases --default-character-set=la
-all.sql
here is the manual for rsync...
http://www.hmug.org/man/1/rsync.php
what you need to do is stop a slave and copy the files directly.
You can also use scp.
http://www.hmug.org/man/1/rsync.php
what you need to do is stop a slave and copy the files directly.
You can also use scp.
0 1 * * * /path_to_directory/file_na
Also, how big is the database you're backing up?
What commands are you using in mysqldump? (ex: --opt -C )