iptables结合ipset定时封禁大量IP

Linux使用iptables封IP,是常用的应对网络攻击的方法,但要封禁成千上万个IP,如果添加成千上万条规则,对机器性能影响较大,使用ipset能解决这个问题。ipset基于linux内核,效率极高,对性能影响忽略不计YUM安装ipsetyum install ipset -y创建ipset库,以hash方式储存IP,超时3600秒释放ipset create black_table hash:ip timeout 3600设置iptables规则,拉黑来自ipset库的ip-A INPUT -m set --match-set black_table src -j DROP将需要拉...

Linux 2018-10-09 PM 2011℃ 0条

Mysql误删闪回--MyFlash

限制:binlog格式必须为rowbinlog_format = rowbinlog_row_image = full仅支持5.6与5.7只能回滚DML(增、删、改)下载地址:https://github.com/Meituan-Dianping/MyFlash/archive/master.zip安装:yum groupinstall "Development Tools" yum install libgnomeui-devel unzip MyFlash-master.zip cd MyFlash-master gcc -w `pkg-config --cfla...

Linux,数据库 2018-10-09 PM 1313℃ 0条

Mysql删除binlog日志

删除10天前的MySQL binlog日志PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY); show master logs;删除所有MySQL binlog日志reset master;实例://清除MySQL-bin.010日志: PURGE MASTER LOGS TO 'MySQL-bin.010'; //清除2018-06-22 13:00:00前binlog日志: PURGE MASTER LOGS BEFORE '2018-06-22 13:00:00'; //清除3天前binlog日志BEF...

Linux,数据库 2018-10-08 PM 1342℃ 0条

CentOS6.9安装Docker并升级至1.9.1

升级系统内核yum update nss rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm yum --enablerepo=elrepo-kernel install kernel-lt -y vim /etc/grub.conf 修改default 为0 reboot 重启安装Docker1.7.1rpm -iUvh http://dl.fedoraproject.org/p...

Linux,docker 2018-10-08 PM 1867℃ 0条

CentOS修改时区为东八区

修改时区为上海vim /etc/sysconfig/clock ZONE="Asia/Shanghai"建立软链接rm /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime设置ntp同步yum install ntpdate 添加任务crontab -e 20 02 * * * /usr/sbin/ntpdate time.nuri.net 20 22 * * * /usr/sbin/ntpdate ntp1.aliyun.com 写入bios hwclock -w

Linux 2018-09-30 AM 3206℃ 1条

根据nginx日志进行访问量统计

1、统计baidu蜘蛛每秒并发,按时间排序grep -i "Baiduspider" access.log | awk '{print $4}' | sort | uniq -c | sort -t":" -k3,42、统计baidu蜘蛛每秒并发,按并发量排序,取前100grep -i "Baiduspider" access.log | awk '{print $4}' | sort | uniq -c | sort -n | tail -1003、统计每个IP访问量排序,取前100cat access.log | awk '...

Linux 2018-09-30 AM 1569℃ 0条

Linux配置SSH免密登录

场景:被登录服务器:A本地客户端:B被登录服务器A操作:1、A开启免密登录功能vim /etc/ssh/sshd_config 如下三行注释去掉 RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys2、重启ssh服务service sshd restart3、创建必要文件mkdir /root/.ssh/ touch /root/.ssh/authorized_keys chmod 700 /root/.ssh/ chmod 600 /root/.ssh/au...

Linux 2018-09-29 PM 1302℃ 0条

MySQL 5.6.17 初始化以及开启root远程登录

初始化数据库scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/mysqldata --user=mysql开启root远程登录grant all privileges on *.* to root@'%' identified by "root";

Linux 2018-09-29 PM 1093℃ 0条