In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "the method of backup and recovery of mysql database of openstack under centos". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
First of all, there has to be a mysql database backup script, it is important to note that for openstack's mysql database, the password for the root account is randomly set, and its value is in / etc/contrail/mysql.token.
#! / bin/bashbackup_dir= "/ opt/backup/mysql" if [!-d "$backup_dir"] Then mkdir-p "$backup_dir" fi# Dump the entire mysql/bin/nice-n 19 / usr/bin/mysqldump-uroot-p`cat / etc/contrail/ mysql.token`-- opt-- flush-logs-- single-transaction-- ignore-table=mysql.event-- ignore-table=mysql.gtid_slave_pos-- ignore-table=mysql.innodb_index_stats-- ignore-table=mysql.innodb_table_stats-- all-databases > ${backup_dir} / mysql- `hostname`-`eval date +% Y% m% d`.'. Sql/bin/nice-n 19 tar zPcf ${backup_dir} / mysql- `hostname`-`eval date +% Y% m% d`.sql.tar.gz ${backup_dir} / mysql- `hostname`-`eval date +% Y% m% d`.sqlrm-rf $backup_dir/*.sql
Then set the backup script to run automatically, for example, to execute at 3: 00 a.m. Every day:
Echo "0 03 * root / usr/bin/sh / opt/backup/shell/backupmysql.sh" > > / etc/crontab
Finally, once the database file is lost due to an exception breakpoint and the mysql service fails to start, install the following steps to restore:
1. Normally, these files are in a database directory that has just been installed with yum
[root@test mysql] # lltotal 28 RW Aug-4 mysql mysql 16384 Aug 29 13:35 aria_log.00000001-rw-rw---- 4 mysql mysql 52 Aug 29 13:35 aria_log_controldrwx--x--x 2 mysql mysql 4096 Dec 21 14:33 mysqldrwx- 2 mysql mysql 4096 Dec 21 14:33 performance_schemadrwxr-xr-x 2 mysql mysql 6 Aug 29 13:35 test
two。 Compare the files in the current / var/lib/mysql/ folder and delete all the extra files
3. Start the database service mysql start
4. Import database files and restore data
# cat / etc/contrail/mysql.tokenf0d330d601ce33f1a69f# mysql- u root-p < / mysql-flexhcs_controller_1-20161221.sqlEnter password: f0d330d601ce33f1a69f "method of backup and recovery of mysql database in openstack under centos" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.