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--
Because the company has many CA platforms, each time you add or modify data, you need to operate on several CA. At the same time, because there is an automatic export script deployed on each CA of the company, if you manually add or modify data to each CA server, it will cause graphics ID inconsistency, resulting in automatic export graphics inconsistent and so on. So do a script. Deployed on the primary CA. And add crontab scheduled tasks. Automatically synchronize all node databases in the early hours of every morning to make all node data consistent.
First, edit the script first
Touch / root/back.shchmod + x / root/back.shvi / root/back.sh
Second, insert the content of the script, the specific parameters can be modified according to the actual situation, and the node can be added or deleted according to its own needs.
#! / bin/bash # Cacti Node Database automatic synchronization script # By:Fenei QQ:407603129# May 12, 2016 # reprint please indicate the source # http://babyfenei.blog.51cto.com/443861/1772494 st=$ (date +% s) USER= "root" PASSWORD= "mysql database password" DATABASE= "cacti" MAIL= "alarm email inbox" # mail BACKUP_DIR=/root/data_backup/CANAME=cacti.sql# backup file storage path Path LOGFILE=/root/data_backup/data_backup.log# log file path DATE= `date +% Y% m% dmury% H% M` # use the date format as the file name DUMPFILE=$DATE.sql ARCHIVE=$DATE.sql.tar.gz OPTIONS= "- u$USER-p$PASSWORD $DATABASE-- ignore-table=cacti.settings" # exclude settings table # to determine whether the backup file storage directory exists Otherwise, create the directory if [!-d $BACKUP_DIR] then mkdir-p "$BACKUP_DIR" fi # before starting the backup Write the backup header to the journal file echo "> > $LOGFILE echo"-"> > $LOGFILE echo" BACKUP DATE: "$(date +"% y-%m-%d% H:%M:%S ") > > $LOGFILE echo"-"> > $LOGFILE # switch to the backup directory cd $BACKUP_DIR Mysqldump $OPTIONS > $DUMPFILE# to determine whether the database backup was successful or not if [[$? = = 0]] then tar czvf $ARCHIVE $DUMPFILE > > $LOGFILE 2 > & 1 echo "[$ARCHIVE] Backup Successful!" > > $LOGFILE rm-f $DUMPFILE# delete the original backup file Just keep the backup package # and back up the package files to another machine. Else echo "Database Backup Fail!" > $LOGFILE # send email to the administrator to remind mail-s "database:$DATABASE Daily Backup Fail!" $MAIL fi echo "Backup Process Done" # backup file is cacti.sql and remote backup to node server cd $BACKUP_DIRmysqldump $OPTIONS > $BACKUP_DIR$CANAME # Unicom CA synchronization # # # scp-P 17121 $BACKUP_DIR$CANAME root@ Unicom IP:/tmp/ > > $LOGFILE 2 > & 1if [[$? = = 0]] then echo "scp is down" ssh-t-p 17121 root@ Unicom IP "mysql-uroot-p Unicom database password cacti
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.