In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to back up the data of Linux/Unix server automatically". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to automatically back up the data of the Linux/Unix server"!
Primabackup.sh documentation
Version: 2.0.1
Tool download address: http://swsoft.com.cn/downloads/Prima/Tools/primabackup-2.0.2.tar.gz
0. Version update
* 2006-11-23 SWsoft.com.cn v2.0.2
-[fix] repair resin path
* 2005-03-28 ValueOf.com v2.0.1
-[fix] backup the configuration of resin and tomcat
-[fix] repair the location of the configuration backup subdirectory
1. Overview
Primabackup.sh scripts can be used to back up data.
two。 Installation
Decompress:
Tar zxf primabackup.tar.gz
3. Configuration
Setting of requirements
3.1 back up to that directory
Root directory where BACKUP_BASE_DIR= "/ backup" backup files are located
3.2 what data is backed up
WEB=1 backup web
EMAIL=1 backup email
DNS=1 backup dns
MYSQL=1 backup mysql
CONTROL=1 backup master interface directory
If you do not need to back up a feature, change it to 0
3.3 how many old backups do you keep?
That is, in addition to the current latest backup, several backups are retained, at least 0, and the default is 1
If set to 0, only one backup is retained, and the previous backup is deleted each time.
Max_old_backup=1
4. The process of backup
First determine the data and configuration to back up based on the settings, and then create the
Back up the date-time directory under the root directory, and back up the data tar package under the data subdirectory of this directory
Back up the configuration files and directories under the confs subdirectory.
5. Data location
The location of web data. The default is / www/users. The program will automatically look for home_base configuration in prima.conf. If found, the changed configuration will be used.
The location of mail data. The default is / var/vmail. The program will automatically look for mail_space_base configuration in prima.conf. If found, the changed configuration will be used.
The location of dns data. The default is / var/named. The program will automatically look for zonefile_base configuration in prima.conf. If found, the changed configuration will be used.
Location of mysql data, linux default / var/lib/mysql,FreeBSD default / var/db/mysql
If the site generation and counter application is open in prima.conf, the corresponding data directory will be backed up.
The program determines whether to back up the corresponding resin and tomcat configurations according to the use_mod_caucho/use_mod_jk in prima.conf.
Named.conf defaults to / etc/named.conf. The program will automatically find the named_conf configuration in prima.conf. If found, the changed configuration will be used.
If you are a master server, be sure to turn on MYSQL backup.
6. About Test Mod
If you set
# testmode=1
Change to
Testmode=1
Then, only what you want to do is printed, not the actual backup.
7. The naming method of backup files
For a backup of the directory. The backup file is the directory name .tar.gz, as shown in
/ www/users-> / backup/20040903-140101/data/users.tar.gz
For a backup of a file, it is directly the file name, such as
/ etc/named.conf-> / backup/20040903-140101/conf/named.conf
The complete list is as follows:
/ www/prima-> data/prima.tar.gz
/ www/users-> data/users.tar.gz
/ var/vmail-> data/vmail.tar.gz
/ var/named-> data/named.tar.gz
/ var/lib/mysql-> data/mysql.tar.gz
/ www/prima/htdocs/apps/GenComSite/sitepage-> data/sitepage
/ www/prima/htdocs/apps/GenComSite/upload-> data/upload.tar.gz
/ var/Counter-> Counter.tar.gz
/ usr/prima/etc-> conf/etc.tar.gz
/ usr/prima/postfix/conf-> conf/conf.tar.gz
/ etc/named.conf-> conf/named.conf
/ usr/local/resin/conf/host.conf-> conf/host.conf
/ var/tomcat4/conf/server.xml-> conf/server.xml
/ www/prima/htdocs/apps/phpMyAdmin/config.inc.php-> conf/config.inc.php
8. Matters needing attention
8.1
Note: this backup is a full backup and the backup directory should have enough space to accommodate it.
Although the space is reduced after compression during the backup process, it is recommended that the backup directory is at least the same size as all the data.
This ensures that at least one full backup can be accommodated and, in general, two full backups.
8.2
When backing up, the burden on cpu and disk is heavy, so it is recommended to add nice to reduce the priority of program execution, and it is best to run in the early morning.
Such as:
# nice. / primabackup.sh
9. Automatic periodic backup via cronjob
Backups can be made periodic and automatic by modifying / etc/crontab.
Each item in / etc/crontab is a periodic task, except for those starting with the # sign.
The format is as follows:
The day of the month, the day of the month, the executor's command line.
For example:
0 2 * root / bin/cmd
That is, execute the / bin/cmd command as root at 2: 00 a. M. every day
If you want to configure the backup task to be executed at 2: 00 every day, and write the output message to the log file, add it to / etc/crontab:
0 2 * root nice / root/primabackup/primabackup.sh > > / var/log/primabackup.log
The above assumes that the location of the backup script is / root/primabackup/primabackup.sh
Log on / var/log/primabackup.log
Nice has been added to lower the execution priority.
If you want to execute at 2 o'clock every Saturday, then:
0 2 * * 6 root nice / root/primabackup/primabackup.sh > > / var/log/primabackup.log
(6 for Saturday, 0 or 7 for Sunday)
There is no need to restart any services to modify / etc/crontab.
At this point, I believe you have a deeper understanding of "how to automatically back up the data of the Linux/Unix server". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.