标签:sele tar select usr cache data style color etc
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.4/binary/redhat/6/x86_64/percona-xtrabackup-24-2.4.4-1.el6.x86_64.rpm yum -y install percona-xtrabackup-24-2.4.4-1.el6.x86_64.rpm
innobackupex --defaults-file=/etc/my.cnf --databases=hcms --user=root --password=123456 --use-memory=10G --parallel=8 /home/sql_bak/ #普通方式指定hcms库不打包备份,不指定库名则为全部备份 time tar -c 2018-07-03_13-43-11/ |pigz -8 -p 15 >hcms.tar.gz #对目录压缩
innobackupex --defaults-file=/etc/my.cnf --user=root --password=123456 --socket=/tmp/mysql.sock --use-memory=10G --parallel=8 --no-timestamp /home/sql_bak/full # 第一次全备不打包压缩
#可写成shell加入定时任务自动备份
#!/bin/bash
#sync
#echo 3 > /proc/sys/vm/drop_caches
#echo 0 > /proc/sys/vm/drop_caches
/usr/bin/innobackupex --user=root --password=‘!qazxsw@pharma$‘ --socket=/tmp/mysql.sock --parallel=8 --use-memory=8G --stream=tar /backup/bak_dir/sql-90full-$(date +%Y-%m-%d) |pigz -8 -p 15 > /backup/bak_dir/sql-90full-$(date +%Y-%m-%d).tar.gz
sleep 2;
/usr/local/bin/rsync -azv --password-file=/etc/rsync.pas --port=873 /backup/bak_dir/sql-90full-$(date +%Y-%m-%d).tar.gz root@10.10.10.xx::90sql
innobackupex --apply-log --use-memory=10G /backup/bak_dir/sql-90full #恢复数据前的准备(合并xtrabackup_log_file和备份的物理文件)非必需
停库: /etc/init.d/mysqld stop lsof -i :3306 破坏数据: cd /home/sqldata/ #注意:恢复的其实是datadir下面的的所有数据 mv mysql /opt/ 恢复: cp -a /backup/bak_dir/sql-90full /home/sqldata/mysql chown -R mysql.mysql /home/sqldata/mysql 启动: /etc/init.d/mysqld start mysql -e "select * from wyy.test" 数据恢复成功。
cal|awk ‘BEGIN{"date +%d"|getline day}{for(i=1;i<=NF;i++) if($i==day) print NR-2}‘ ##判断今天是本月的第几周
标签:sele tar select usr cache data style color etc
原文地址:https://www.cnblogs.com/qianjingchen/p/9552327.html