phpbu
phpbu copied to clipboard
Need more exampales
How to backup files from remote host? RSync? How to configure connection with login/password? Need full config example with source and target sections.
Can I use ssh to execute mysqldump on remote host and sync dump file after?
Hi, currently it is not possible to execute mysqldump on a remote host via ssh. But that's a nice feature request.
<backup>
<source type="rsync">
<option name="path" value="/tmp/foo"/>
<option name="user" value="bob"/>
<option name="host" value="example.com"/>
</source>
<target dirname="/backup" filename="collected-files%Y%m%d" compress="bzip2">
</backup>
This will use rsync to connect as user bob to example.com and sync the /tmp/foo directory to your local directory /backup and create a tar.bz2.
You have to make sure "bob" has passwordless access to your remote host so you have to use keys to authenticate.
Thanks.
Little bugreport (not critical for me, but may be usefull for you):
On windows 10x64 with cygwin rsync work's only with full local cygwin path and without compression.
<target dirname="/cygdrive/c/wamp64/_sites/_test/backup/files" filename="files-%Y%m%d-%H%i" />
Other path variation fail with message:
Exception 'phpbu\App\Exception' with message 'rsync failed:The source and destination cannot both be remote. rsync error: syntax or usage error (code 1) at main.c(1292) [Receiver=3.1.2] ' in phar://C:/wamp64/_sites/_test/phpbu.phar/Backup/Source/Rsync.php:54
With compression fail with message:
Exception 'phpbu\App\Exception' with message 'path to compress should be valid: /cygdrive/c/wamp64/_sites/_test/backup/files\files-20170301-1048' in phar://C:/wamp64/_sites/_test/phpbu.phar/Backup/Compressor/Abstraction.php:63
Thanks I will have a look at this
I think it's possible to use ssh command to execute the remote mysqldump command.
The related tutorial is available here. The related command is as follows:
ssh username@hostname 'mysqldump....'
If we can execute remote command via ssh command, this will be convenient for us to do the backup work :).