Skip to content

openstack_mysql_backup

遇见王斌 edited this page Feb 25, 2018 · 7 revisions

MySQL 备份

准备

  • MySQL tools 安装
  • 需要备份数据的服务器上安装 MySQL client
    • yum -y install mysql
  • Controller 服务器上创建 MySQL 普通用户访问权限(在 MySQL 中执行)
    • GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypasswd' WITH GRANT OPTION;
    • GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'127.0.0.1' IDENTIFIED BY 'mypasswd' WITH GRANT OPTION;
    • flush privileges;

修改配置文件

/opt/X_crontab/mysqlbackup/backupdb.config

db_dump=mysqldump
db_mysql=mysql
mysql_account=myuser--------[需要修改]
mysql_password=mypasswd-----[需要修改]
db_addr=mysqlIP-------------[需要修改]
db_port=3306
back_dir=/openstack/mysql_backup
db_list=nova|nova_api|nova_cell0|neutron|keystone|glance|cinder
log_dir=/openstack/mysql_backup/logs

测试

bash /opt/X_crontab/mysqlbackup/backmysql.sh