1.linux下time_wait过多问题
使用命令查看状态 netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"t",state[key]}'
编辑/etc/sysctl.conf:增加内容
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
sysctl -p 保存
2./usr/sbin/httpd: error while loading shared libraries: libaprutil-1.so.0: cannot open shared object...directory
yum install apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-88.el7.centos mailcap.noarch 0:2.1.41-2.el7
3.mysql修改lower_case_table_names=1时可能导致某些数据库表报不存在问题:
a.当初始建立mysql数据库时未指定lower_case_table_names=1并创建了大写字母的表名称,在把lower_case_table_names=1时,原来以大写字母命名的表将会报不存在的问题。
解决办法:先lower_case_table_names=0,再把所有以大写字母建立的表改成小写命名。如rename table USER to user, 之后再把lower_case_table_names=1即可。
4.tomcat8.5版本之后程序上传的文件或图片默认其他没有读操作问题:
如ceshi1224.png为java程序默认上传的图片,其他用户没有可读。
检查linux umask为0022,不是系统umask导致的。查阅tomcat8.5文档发现为,catalina.sh 默认权限改为了0027
将其UMASK=0022即可解决上传文件默认其他用户无写权限问题
5.安装dig命令:
yum install bind-utils
6.安装zabbix报错连不上mysql:
关闭selinux:
setenforce 0
getenforce
永久生效vi /etc/selinux/config
SELINUX=disabled
7.Access denied for user 'root'@'localhost' (using password: YES)
修改/etc/my.cnf,添加skip-grant-tables
重启mysqld
8.授予指定用户对指定数据库的权限
GRANT SELECT,INSERT, UPDATE, DELETE, CREATE, DROP,ALTER,INDEX,EVENT ON db_invest_prj_test.* TO 'dbtest'@'%' ;
9.mysql 格式化时间:
DATE_FORMAT(NOW(),'%Y%m%d')
10.mysql 创建存储过程并定时调用
查询mysql是否开启事件功能:SHOW VARIABLES LIKE 'event_scheduler'
没开启时,SET GLOBAL event_scheduler = ON;
创建存储过程
drop procedure if exists count_user;
create procedure count_user()
begin
SET @x = DATE_FORMAT(NOW(),'%Y%m%d');
SET @sql = CONCAT("create VIEW ct_",@x," as SELECT
DATE_FORMAT(NOW(),'%Y%m%d') as 'aa',c.`name` as 'bb',a.id
FROM
t_client_user a
LEFT JOIN t_client_user_ext b ON a.id = b.id
LEFT JOIN sys_office c ON c.id = a.office_id
where b.is_activation=0");
PREPARE stmt from @sql;
EXECUTE stmt;
end;
创建定时器事件,每天调用一次
drop event if exists countUser_event;
CREATE EVENT test_event ON SCHEDULE EVERY 1 DAY STARTS '2019-01-20 15:00:00'
ON COMPLETION PRESERVE ENABLE DO CALL count_user()
开启事件
alter event test_event on completion preserve enable;
关闭事件:
alter event test_event on completion preserve disable;
11.安装percona-toolkit-3.0.13报错
安装 yum -y install perl-CPAN
yum -y install perl-Digest-MD5