Linux file backup

Source: Internet
Author: User

  

An application has a lot of important data, in order to be in a timely, rapid and accurate recovery of our application to a more appropriate location after the data disaster, we must regularly back up our data, we share today is the Linux file backup method.

1. Manual backup of native data

With the powerful tar command on Linux, Tar was originally designed to make tape backups, which were intended to back up files and directories to tape and then extract or recover files from tape. Now we can use tar to back up the data to any storage medium.

The tar command backs up the data in the following format:

Tar cvf backup.tar/home/www The meaning of this command is to package/home/www/as a Backup.tar file, and if we need to compress it, we need to add the z command.

With this command, we can manually back up the data on the server, but to do it automatically at regular intervals, we need to use the next trick.

2. Automatic backup of native data

To implement automatic backup, we first need to write the tar command in the script. For example, a script like the following:

#!/bin/sh

Tar zcvf test.tar/home/www/

Save as test.sh and add executable permissions, after execution, discover prompt: Tar:removing leading '/' from member names

This problem is due to the fact that the script executes in the user directory by default. This is the problem, and the solution is to switch the CD to the directory you want to package before executing the tar.

With a script that can execute the command, and the ability to execute it on a regular basis, this is done by planning the task.

Linux provides us with a powerful tool for cron, which we can use to achieve almost any type of timed trigger. Each user has his own cron profile, and in general we run cron tasks through the root user to ensure that we have sufficient privileges.

If we want to run our pre-written script four o'clock in the morning every day, we can edit the configuration file via Crontab-e and add:

0 4 * * */home/test.sh

In this way, the backup script is automatically run 4 o'clock in the morning every day.

3. Data backup software-multi-backup

About multiple backups:

Multi-backup enterprise file Automatic backup software is a computer and server file automatic scheduled backup and recovery of data protection software, it can achieve hybrid backup, both the data back to the local, but also to backup to the cloud, compatible with Windows, Linux and other mainstream platforms. Compared to traditional file backup software, multi-backup provides a variety of flexible deployment and usage, the enterprise can use multi-backup client to protect data on a single device, can also centrally manage all device data in the Web console, and can manage the data protection work of up to tens of thousands of devices simultaneously.

So, how do you use the client for backup?

1. Download the Linux version of the installation package: Log on to the host (root login), enter the command: wget http://www.dbfen.com/tools/dbfen_install.sh Enter

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/67/wKioL1Vj4jPxv4j0AAGOfJufPkY408.jpg "title=" Picture 1.png "alt=" Wkiol1vj4jpxv4j0aagofjufpky408.jpg "/>

2. Enter LS return, there is a dbfen_install.sh file display

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/6C/wKiom1Vj4K2Cqy9SAABYh_rBV94405.jpg "title=" Picture 2.png "alt=" Wkiom1vj4k2cqy9saabyh_rbv94405.jpg "/>


3. Enter Bash dbfen_install.sh carriage return, prompting for successful installation and hints

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6D/6C/wKiom1Vj4LXiy4c-AAIdGS-DW1g920.jpg "title=" Picture 3.png "alt=" Wkiom1vj4lxiy4c-aaidgs-dw1g920.jpg "/>


4. Start the service, enter the command:/usr/local/services/dbfen/startdbfen Enter, OK, start successfully. Restart Service command:/usr/local/services/dbfen/startdbfen restart

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6D/67/wKioL1Vj4sDQwNffAABuGxq2gFo078.jpg "title=" Picture 4.jpg "alt=" Wkiol1vj4sdqwnffaabugxq2gfo078.jpg "/>


If you are a native access, simply open the browser input 127.0.0.1:40000/view/index.html.

If it is another computer access, enter http://Install the Linux client machine ip:40000/view/index.html. OK, now let's take a look at how to make a backup

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6D/6C/wKiom1Vj4TmB5qBCAAEW9ivcPj4784.jpg "title=" Picture 5.png "alt=" Wkiom1vj4tmb5qbcaaew9ivcpj4784.jpg "/>


(1), open the MySQL database backup, fill in the database related parameters.

IP: Default 127.0.0.1; Domain name: localhost

User name: Account name of the login database

Password: password to log in to the database

Port number: Default 3306, or find mysql.ext and open, enter the password and press ENTER, after mysql> enter "show global variables like ' Port ';" Enter

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6D/67/wKioL1Vj4tPwkUwLAADurTZWrdo017.jpg "title=" Picture 6.png "alt=" Wkiol1vj4tpwkuwlaadurtzwrdo017.jpg "/>


(2), fill out the parameters, click "Next", tick the database that needs to be backed up, click "Done", the task is created (the file began to be automatically backed up)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/67/wKioL1Vj4uzABvCjAAD0az0lQG4819.jpg "title=" Picture 7.png "alt=" Wkiol1vj4uzabvcjaad0az0lqg4819.jpg "/>


(3), click "Set Frequency" under "Operation", set the frequency of task backup; " Edit Parameters "Set the user name, password, port number of the connection number library; Backup content re-selects the database that needs to be backed up.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6D/67/wKioL1Vj4vejcwHeAADcegOf5Kk496.jpg "title=" Picture 8.png "alt=" Wkiol1vj4vejcwheaadcegof5kk496.jpg "/>


Tip: If you need to create a database backup task again, click "Backup Content" under "Actions", click "Add Database", and then follow the same steps as when creating the first database task.

(If the number of tasks is not enough, please redeem the number of tasks on the official website; only one can be created for the same database)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6D/67/wKioL1Vj4wLA2JZsAAEGGv8C8D8074.jpg "title=" Picture 9.png "alt=" Wkiol1vj4wla2jzsaaeggv8c8d8074.jpg "/>


This article is from the "Baboon Master Data Backup" blog, reproduced please contact the author!

Linux file backup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.