从MySQL备份中恢复单个表

  1. sed -n -e '/DROP TABLE.*$Table_Name/,/UNLOCK TABLES/p' MySQL_Backup.sql >> MySQL.$Table_Name.restore
  2.  
  3. mysql:
  4. use $DB_Name
  5. source MySQL.$Table_Name.restore

torshammer

  1. #enable epel & install tor
  2. #ulimit -n 1024000
  3. #service tor start
  4.  
  5. curl -L 'http://downloads.sourceforge.net/project/torshammer/Torshammer/1.0/Torshammer%201.0.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ftorshammer%2Ffiles%2FTorshammer%2F1.0%2F&ts=1439278986&use_mirror=nchc' -o torshammer.zip
  6.  
  7. unzip torshammer.zip

net_speeder网络加速

  1. wget http://net-speeder.googlecode.com/files/net_speeder-v0.1.tar.gz
  2. #项目github地址 https://github.com/snooda/net-speeder
  3. yum install libnet libpcap libnet-devel libpcap-devel gcc -y
  4. bash build
  5. ./net_speeder eth0 "ip"

MySQL不中断在线添加从库

  1. #全备份(这数据不能直接用的,或许有未提交的事务或者事务还在日志里并未写入硬盘)
  2. $Master: innobackupex --user='root' --password='$Password' --defaults-file=/etc/my.cnf /data/test/fulltest --socket=/tmp/mysql.sock 
  3.  
  4. #apply-log(apply log后的数据才可直接使用)
  5. $Master: innobackupex --apply-log /data/test/fulltest/2015-06-04_16-41-51/
  6.  
  7. #恢复
  8. $Slave:清空New_Slavedatadir
  9.  
  10. #移动ib_logfile文件到MySQL的log文件夹
  11. $Slavemv ib_logfile* /path/to/mysql/log/
  12.  
  13. #修改my.cnf
  14. 修改server-id=xx
  15.  
  16. #启动mysql服务
  17. $Slaveservice mysqld start
  18.  
  19. #查看文件xtrabackup_binlog_info查看binlog位置并change master;
  20. $SlaveCHANGE MASTER TO MASTER_HOST='$masterip', MASTER_PORT=3306,MASTER_USER='$repl_user',MASTER_PASSWORD='$slavepass',MASTER_LOG_FILE='$bin.000001',MASTER_LOG_POS=481;
  21.  
  22. #启动从库服务
  23. $Slaveslave start

参考:percona-xtrabackup-setting_up_replication

fail2ban解封IP

fail2ban可以解封或者添加IP到白名单,但网上基本都是写的直接改iptables

  1. 错误提示:
  2. ERROR  NOK: ('Invalid Action name',)
  3. 'Invalid Action name'
  4.  
  5. 日志提示:
  6. May 11 17:12:32 localhost fail2ban.comm[132096]: WARNING Command ['get', 'JAIL', 'actionban', 'x.x.x.x'] has failed. Received KeyError('Invalid Action name',)
  7.  
  8. fail2ban解封命令:
  9. fail2ban-client set [$JAIL_Name] unbanip [xx.xx.xx.xx]