In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First of all, the Perl package and DBD/DBI of the system must be complete, and the version must correspond well, otherwise it is easy to make mistakes in calling mysqlhotcopy. The famous mistake is:
Can't locate DBI.pm in @ INC
Also note that the digits of OS and Mysql must be the same, otherwise an error will occur when Mysqlhotcopy calls perl.
[@ more@]
Take mysql 4.0.27 as an example. For DBI, we choose DBI-1.53,DBD and DBD-mysql-3.0008.
Upload 2 packages to the server and install them directly with yum, but in some cases there will be errors in the version that make hotcopy unavailable.
Tar zxvf DBI.tar.gz
Cd DBI-1.53
Perl Makefile.PL
Make
Make test
Make install
Tar zxvf DBD-mysql-3.0008.tar.gz
Cd DBD-mysql-3.0008
Perl Makefile.PL-mysql_config=/usr/local/mysql/bin/mysql_config
Make
Make test
Make install
When you finish the installation, you can test the pull.
Here is the backup script:
#! / bin/bash
#
# Use mysqlhotcopy backup mysql database
#
Cmd='/usr/local/mysql/bin/mysqlhotcopy-Q'
BackupPatch='/usr/backup/data'
Logfile='/usr/backup/data/backup.log'
DBNAME= `ls-l / usr/local/mysql/data/ | grep'^ d' | awk'{print $9}'`
Error () {
Case "${1}" in
1)
Echo "mysqlhotcoyp error"
Exit 1
2)
Exit 2
*)
Useage
Esac
}
Do_check () {
For loop in $DBNAME
Do
[- d $loop] & & rm-rf $BackupPatch/$loop
Done
}
Do_backup () {
$cmd $DBNAME $BackupPatch 2 > > $logfile | | {date > > $logfile;error 1;}
}
Do_compress () {
Cd $BackupPatch
Ts= `date +% Y% m% d`
Fname=db.$ts.tgz
[- f $fname] & & rm $BackupPatch/$fname
Tar czvf $fname $DBNAME
}
Check_3 () {
Num= `ls * .tgz | wc-l`
If [$num-gt 3]; then
Do_delold
Check_3
Fi
}
Do_delold () {
Old= `ls * .tgz | sort | head-n 1`
Rm-f $BackupPatch/$old
}
# Main###
Cd $BackupPatch
Echo "- backup start at $(date +"% y-%m-%d% H:%M:%S ") -" > > $logfile
Do_check
Do_backup
Do_compress
Check_3
Do_check
Chown-R backup.backup $BackupPatch/
Echo "- backup finish at $(date +"% y-%m-%d% H:%M:%S ") -" > > $logfile
Exit 0
After the backup, you can use md5sum to generate the check code. Once you need to transfer the remote backup, you can verify it.
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.