I'm tryng to set up a new Slave DB by copying another Slave DB. Normally I would simply use MySQLDump
to dump the Slave and create a .sql
file, then import that into the new database.
However, as our new server is a Linux (Debian 7) server (the slave I'm copying is on a Windows server), I figured I would try to pipe the dump straight into the new database. This seemed to go well, until my putty session expired and it all stopped.
I tried it again, this time using nohup .... &
. But still the dump stopped as soon as my session expired.
Is there a way to make this work? My full dump command is:
nohup mysqldump -hxxx -P3306 -uxxx -pxxx --dump-slave --databases a b c d --ignore-table=a.xxx -F | mysql -h127.0.0.1 -P3306 -uxxx -pxxx &
All DB's are MySQL 5.5.
Best Answer
I think I found the problem. Apparently the
nohup
command ended at the|
symbol, so when the session expired the second part of the command stopped with the session.To get round this I ran:
nohup sh -c 'mysqldump -hxxx -P3306 -uxxx -pxxx --dump-slave --databases a b c d --ignore-table=a.xxx -F | mysql -h127.0.0.1 -P3306 -uxxx -pxxx' &
I checked it was running, and then
EXIT
ed the shell, and so far, it is still running.