|
The importance of each system management system recognize frequent backup or disaster experience makes careful. You can write workable legacy shell scripts, or using one (or several) backup tool for the job to complete the backup task. So, when you want to implement a backup solution, backup tools, the more you know, the more you make wise decisions.
In this article, we will introduce you backupninja, this is a lightweight and easy to configure system backup tool. With the help of such rdiff-backup, duplicity, mysqlhotcopy and mysqldump under other procedures, Backupninja backup can provide common functions, such as the implementation of a remote, secure and incremental file system backups, encrypt backup and MySQL / MariaDB database backup. You can selectively turn on using the Email status reports, which can also general information on hardware and system backup. Backupninja a key feature is that it has a built-in console-based wizard (called ninjahelper), which allows you to back up different scenarios and easily create a configuration file.
If I have to say, backupninja disadvantage is: In order to fully use all its functions, it requires the installation of a number of other "helper" program. Although there are backupninja based installation package for Red Hat (Red Hat) releases of RPM, but backupninja releases for Debian and its derivatives depends optimized. So I do not recommend trying backupninja on Red Hat-based systems.
In this tutorial, we'll show you how to install backupninja on Debian-based distributions.
Installation Backupninja
To root account to run the following command:
# Aptitude install backupninja
During the installation, there are several files and directories will be created:
/ Usr / sbin / backupninja is a bash shell script master;
/etc/cron.d/backupninja, by default, set up a cron task to run every hour above the main script;
/etc/logrotate.d/backupninja truncate the log generated by the backupninja program;
/etc/backup.d/ directory configuration file backup operations resides;
/etc/backupninja.conf is the main configuration file contains general options. The files with good comments and a detailed explanation of the meaning of each option;
/ Usr / share / backupninja directory is used by those scripts backupninja located. The script file is responsible for performing the actual work. In this directory, you can also find .helper files that can be used to configure and set ninjahelper menu;
/ Usr / share / doc / backupninja / examples contains the operating configuration files (ie, files produced by ninjahelper) template.
First Run Ninjahelper
When we try to start ninjahelper, we may need to see an internal dependency program. If the system was prompted, enter "yes" and Qiaoxia Enter to install dialog (a tool used to display a friendly dialog boxes from shell scripts).
When you hit the Enter key after typing yes, backupninja will install dialog, once the installation is complete, will appear in the screenshot below:
Case 1: backup hardware and system information
After starting ninjahelper, we will create a new backup:
If necessary, the assistant program is not installed, the following screen shot will be presented in front of us. If these packages are already installed on your system, skip this step.
The next step requires you to select the relevant entry as part of the backup job. The first four entries have been chosen by default, but you can press the spacebar on the entry to undo selection.
Once you have completed the above steps, press OK option to continue. Then you will be able to choose is willing to use the default configuration file (/etc/backup.d/10.sys) to complete the backup operation, or create a new profile. In the latter case, a default configuration file containing the contents of the same file will be created in the same directory, but it is named 11.sys, subsequent backup operations will create a similar document (Note: only named different serial number). It should be noted that once the new profile is created, you can use your favorite text editor to edit the file.
Case 2: a remote directory incremental backup Rsync pull
As you most probably know, rsync is widely used by the network to synchronize files or folders. In the next example, we will discuss the use of a hard link to do a remote directory incremental pull backup method, which is used to save and restore the historical data historical data in our local file server. This approach will help us to save space and increase security on the server side.
Step 1: Write a custom script with the following content on /etc/backup.d, and its permissions set to 600. It should be noted that, in addition to the general configuration files, this directory may also contain backupninja executed when you want to run some script files that can play in the main configuration file variable advantage.
# REMOTE USER
user = root
# REMOTE HOST
host = dev1
# REMOTE DIRECTORY
remotedir = / home / gacanepa /
# LOCAL DIRECTORY
localdir = / home / gacanepa / backup.0
# LOCAL DIRECTORY WHERE PREVIOUS BACKUP WAS STORED
localdirold = / home / gacanepa / backup.1
mv $ localdir $ localdirold
# RSYNC
rsync -av --delete - recursive --link-dest = $ localdirold $ user @ $ host: $ remotedir $ localdir
In the above configuration, the role of the rsync '--link-dest' option is located in the directory $ localdir-old who does not change the file (containing all the attributes) hard links to the target directory ($ localdir).
Step 2: Before backupninja first run, the parent directory (in this case the middle finger is / home / gacanepa) is empty. The first time we execute the following command:
# Backupninja -n
backup.0 directory is created, and in the next process, its name will be changed to backup.1.
When our second run backupninja, backup.0 will be re-created, and backup.1 remain intact.
Step 3: Make sure backup.1 inside the file to backup.0 hard links in the file, we can (i node) number and the size of the directory to achieve this by comparing the file's inode.
to sum up
Backupninja is not only a classic backup tool, it is also an easy-to-configure utility. You can write your own script control, with on /etc.backup.d different configuration file to run backupninja. Even you can also write ninjahelper assistant program, and include it in the ninjahelper main interface.
For example, if you create a control script called xmodulo in / usr / share / backupninja directory, it will automatically run those located /etc/backup.d directory to .xmodulo suffix for each file. If you decide to add your script to ninjahelper xmodulo control, you can write the appropriate helper program that xmodulo.helper. In addition, if you want to make backupninja running another script, just add it to /etc/backup.d directory on it. |
|
|
|