SSH is a wonderful piece of software. I found (hum, Philippe, the CentOS package maintainer, president of the Firebird Foundation and member of the QA team of Firebird helped me to find) how to create a SSH tunnel through I can run a distant Firebird backup.
This is the standard gbak command :
$ gbak -b [-v] XXX.XXX.XXX.XXX:database backup.fbk -user SYSDBA -password masterkey
With that command you can create a LOCAL backup of a REMOTE database.
With this command :
$ gbak -b [-v] -service XXX.XXX.XXX.XXX:service_mgr database /path/to/backup.fbk -user SYSDBA -password masterkey
You will create a REMOTE backup (in /path/to/backup.fbk) of a REMOTE database.
Now, how can I create a LOCAL backup for a REMOTE database with stream compression and encryption ? By using SSH Tunnelling.
$ ssh -C -f user@XXX.XXX.XXX.XXX -L 3052:localhost:3050 -N
This will run a background (-f) SSH Tunnel (-L) mapping local port 3052 to remote port 3050 (3052:localhost:3050) with compression (-C, or -o Compression=yes) and without running a remote command (-N)
Now we can use this tunnel to start a secured/compressed remote backup :
$ gbak -b [-v] localhost/3052:database backup.fbk -user SYSDBA password masterkey
Note : “database” can be an alias name, if defined in /etc/firebird/aliases.conf (location depends on your distribution package maintainer, at least this is where I can find this file on CentOS 5.3 using EPEL Testing repository) or the full path of the database on the host system. “backup.fbk” is the local path of the backup file.
You will restore this backup locally by using this command :
$ gbak -c [-v] backup.fbk database -user SYSDBA -password masterkey
Of course, you will have to adjust the user/password depending on your own configuration.
-
Very nice tip!! Thanks!!!
3 comments
Comments feed for this article
Trackback link: http://levosgien.net/2009/06/17/tunnelling-a-firebird-backup-with-ssh/trackback/