[asset全局备份,为uat准备] [[email protected] 桌面]# ssh 资产服务器 [[email protected] ~]# mkdir 201512181256-allback [[email protected] ~]# innobackupex --user=root -password=asset 201512181256-allback/ [[email protected] ~]# ll 201512181256-allback 总用量 4.0K drwxr-xr-x. 7 root root 4.0K 12月 18 12:57 2015-12-18_12-56-47 [[email protected] ~]# tar -zcf 201512181256-allback.tar.gz 201512181256-allback/ [[email protected] ~]# ll 201512181256-allback.tar.gz -rw-r--r--. 1 root root 28M 12月 18 13:34 201512181256-allback.tar.gz [[email protected] ~]# scp 201512181256-allback.tar.gz 192.168.uat:/home/ [email protected]‘s password: 201512181256-allback.tar.gz [mysqldump备份uat的iTop 表] [[email protected] 桌面]# ssh asset-uat 导入时,会自动创建这个表 [[email protected] ~]# mysqldump -uroot -p --databases itop --lock-all-tables --flush-logs > 20151218iTop.sql Enter password: [[email protected] ~]# grep datadir /etc/my.cnf datadir= /mydata/data [[email protected] ~]# service mysqld stop Shutting down MySQL.. SUCCESS! [[email protected] ~]# rm -rf /mydata/data/* 【整理、恢复,asset的全部到uat】 [[email protected] home]# innobackupex --apply-log 201512181256-allback/2015-12-18_12-56-47/ 151218 13:40:35 innobackupex: completed OK! [[email protected] home]# innobackupex --copy-back 201512181256-allback/2015-12-18_12-56-47/ [[email protected] home]# chown -R mysql:mysql /mydata/data/ [[email protected] home]# service mysqld start Starting MySQL. SUCCESS! 【mysqldump uat的iTop 表恢复】 mysql> set sql_log_bin=0; mysql> source /root/20151218iTop.sql mysql> set sql_log_bin=1;
时间: 2024-10-11 23:00:21