How to backup MySQL to your own storage servers
When a user signs up for online backup service for MySQL we allocate two gigabytes of free disk space in our storage. It’s convenient for small databases. We manage the storage, no additional hardware is needed from the user. What if the database is large enough so 2 gigabytes is not enough?
TwinDB allows to backup MySQL to your own storage servers. The storage will be visible in TwinDB console, the dispatcher will set it as a destination server when scheduling backup jobs and will enforce retention policy.
But the biggest benefit of having your own storage server in TwinDB is that backup copies never leave your data center. The agents are still managed by TwinDB dispatcher, but when XtraBackup streams a backup copy it’s encrypted and piped over ssh to your server. That increases security of the solution – your data flow is under your control. Besides, no large amounts of data are transferred to the cloud.
The storage server can be a Linux machine, we support and distribute packages for RedHat and Debian based systems.
Backup copies will be saved in /var/twindb-sftp . I recommend to create a separate partition for backups:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.8G 1.9G 5.8G 25% /
devtmpfs 490M 64K 490M 1% /dev
tmpfs 499M 0 499M 0% /dev/shm
/dev/mapper/data-storage 99G 7.6G 86G 9% /var/twindb-sftp
The storage server must be accessible via TCP port 4194 for TwinDB agents and TwinDB dispatcher.
Now, to add your own storage server log in to https://console.twindb.com. Open a “Storage” item in the left menu and press “New” button
It will open a window with further instructions:
There are two steps actually:
- Install twindb-server-storage package from TwinDB repository. We support RedHat/CentOS and Debian/Ubuntu. See TwinDB repository page for instructions.
- Register the storage server. The exact command with your registration code will be shown in the window.
# twindb-register-storage 3690150723f6d732bc9c710ca68a8ec3
2015-06-06 03:20:58,503: twindb: INFO: register(): line 129: Registering TwinDB storage server with code 3690150723f6d732bc9c710ca68a8ec3
2015-06-06 03:20:58,568: twindb: INFO: register(): line 179: Received successful response to register the storage server.
2015-06-06 03:20:58,569: twindb: INFO: register(): line 180: The storage server successfully registered in TwinDB
2015-06-06 03:20:58,569: twindb: INFO: register(): line 182: Creating local user user_id_1
2015-06-06 03:20:59,305: twindb: INFO: confirm_storage_registration(): line 245: Received successful response from dispatcher
2015-06-06 03:20:59,305: twindb: INFO: register(): line 192: Success
That’s pretty much it. TwinDB will see the new storage server and will use it as a destination for further backup jobs. You can add as many storage servers as you need.