Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taking backup remotely using innobackupex

I am trying to take backup from a remote machine using innobackupex.

./innobackupex --host=<mysql_server> --user=<username> <backup_dir>.

Its failing as it is unable to locate a directory in the server.

 (Errcode: 2 - No such file or directory)

I am assuming it is searching for the directory in the local machine. Please let me know how can we run the backup remotely ?

like image 306
user3351750 Avatar asked Jan 19 '16 09:01

user3351750


1 Answers

I suspect you are confusing innobackupex with something like mysqldump. The former backs up the actual table files, while the latter connects to the database server and pulls the data.

Since it is trying to backup the database files it will of course need access to the filesystem on the database server, and can't be run remotely.

What you can do is stream the contents of the backup to a remote machine:

innobackupex --stream=tar ./ | ssh user@desthost "cat - > /data/backups/backup.tar"

Or just save the resulting backup file onto a different server with the method of your choice (e.g. shared drive, scp, rsync)

like image 78
miken32 Avatar answered Oct 17 '22 11:10

miken32