|
QuickStartGuide
Table of ContentsIntroductionThis guide should be all you need to get up and running with XtraBackup Manager quickly. The project is currently in Beta status, so please use with caution in production environments -- if you would like to play with the software and provide feedback, please do so! Requirements
Installing and ConfiguringInstalling XtraBackup ManagerNote: In the steps below, "xbm" is used as the mysql password for the user xbm. It is recommended you exchange that for your own password instead.
shell> su - xbm shell> tar xvzf xtrabackup-manager-noarch-0.81-r229.tgz shell> mysql -u root -p mysql> CREATE DATABASE xbm CHARACTER SET utf8; mysql> CREATE USER 'xbm'@'localhost' IDENTIFIED BY 'xbm'; shell> cd $HOME/xtrabackup-manager shell> mysql -u xbm -pxbm xbm < sql/schema_init.sql shell> xbm host list You should see output like: XtraBackup Manager v0.6 - Copyright 2011 Marin Software
-- Listing all Hosts --
No hosts configured.
Congratulations! You are ready to setup your backups Preparing The Database Systems You Plan To BackupSetting up SSH TrustThe first thing you need to do is setup SSH trust between your backup host and any database hosts you plan to backup. There may be better ways of achieving passwordless SSH login to remote hosts, but this is the simplest way I know. Please feel free to provide feedback via Issues in Google Code.
shell> su - xbm shell> ssh-keygen -t dsa shell> xbm backup edit <hostname> <backupName> backup_user <username> shell> chmod 700 .ssh shell> chmod 600 .ssh/authorized_keys shell> ssh mysql@backuphost shell> host backup01 Congratulations! You've now perform the necessary steps backup this remote database host with XtraBackup Manager. Install XtraBackupXtraBackup needs to be installed and in the $PATH in two key places. # The user that XtraBackup Manager will run under on your backup server # The user you will use to connect to your remote database hosts - in our example above, this was the mysql user. You should be able to find the information you need to download and install from the Percona XtraBackup Download Page. After you have installed XtraBackup, test to see that you can run xtrabackup and innobackupex by just typing the command under the XtraBackup Manager user on the backup server host and under the remote user on your remote database host(s). If not, you may need to setup some symlinks or add the directory with the XtraBackup binaries in it to your $PATH. Configuring Your BackupsSetting up a Storage VolumeXtraBackup Manager needs to know where to store all of the backup data. Make a directory somewhere with plenty of storage. Ensure the directory is owned/grouped to your XtraBackup Manager user and add it to XBM as a storage volume as follows:
The above will add a storage volume with the name "backup1" at /backup1 to XtraBackup Manager. Easy! Adding a Remote Database Host To BackupTo backup a MySQL instance, you'll need to add the host to XtraBackup Manager and give it a description. You can use the xbm command-line tool as follows: shell> xbm host add "db01.mydomain.com" "Production DB #1" Note: You will mostly refer to the remote database host by its hostname - the description is predominantly to make it easier for you keep track of your various hosts. Adding a Backup TaskOnce you have setup a storage volume and added your remote database host, the next step is to schedule a backup task for that host. Before we proceed, you should know that XtraBackup Manager supports a few different strategies for managing your backups. Since this is a quick start guide and it should remain simple, we're just going to just select a strategy without too much discussion. It is important for you to keep in mind that you can only define which backup strategy to use at the time you add each scheduled backup task, so it will be important for you to read more about BackupStrategies before you start using this tool seriously. For the purposes of this example, we're just going to go with ROTATING, but if you have the time, I highly recommend reading about BackupStrategies now. Aside from selecting a backup strategy, you'll need to have the following information in order to add your scheduled backup task.
Once you have all of the above at hand, you can add the scheduled backup task with syntax as follows: shell> xbm backup add <hostname> <backup_name> <strategy_code> <cron_expression> <backup_volume> <datadir_path> <mysql_user> <mysql_password> An example would be: shell> xbm backup add "db01.mydomain.com" "nightlyBackup" ROTATING "30 20 * * *" "Storage Array 1" /usr/local/mysql/data backup "p4ssw0rd" NOTE: XtraBackup manager will default to using the Unix username 'mysql' to SSH into the database you wish to backup and run the backup. If you would like to change this you can use a command like the following: shell> xbm backup edit "db01.mydomain.com" "nightlyBackup" backup_user myNewUser |
In CentOS / Redhat users can't change their ulimit. You need to add 'ulimit -n 65535' to the end of the /etc/profile file.
Hello,
I have a little issue regarding the "Decide which user you are going to use to connect to the databases you wish to backup." part. I did everything to connect with the "xbm" user everywhere, but I can't find an option on xbm console or in the config.php file to determine the system user used for the remote connection to the host I want to backup.
When I run xbm, I always have:
2012-04-19 14:47:21 -0500 INFO? : Using Backup Strategy: Rotating sets of Incremental Backups 2012-04-19 14:47:21 -0500 INFO? : Using DAY_OF_WEEK as the rotation method... 2012-04-19 14:47:21 -0500 INFO? : No snapshots found for this scheduled backup at all - taking an initial full backup. 2012-04-19 14:47:21 -0500 INFO? : Attempting to find available ports for use... 2012-04-19 14:47:21 -0500 INFO? : Got lock on port 10000. mysql@myhost's password:
I'm trying to make it connect using xbm@myhost instead. What should I change? Thanks!
Hi Alban,
It seems I could have made this clearer in the docs.
There is a param/setting on the scheduled backup task that you created that will always default to "mysql"… you can edit this with:
xbm backup edit hostname backup name backup_user <yournewuser>
let me know if this solves the problem for you.
Best, Lachlan