遇到的问题

1.连接数问题

之前遇到过数据库的连接数满了,应该是配置的jdbc的数量太多,看看数据库配置,所支持的最大连接数多少


image.png

image.png

image.png

原因是sleep 会话太多,sleep是jdbc连接池 与mysql的空闲连接,一个会话会占一个连接,当时把mysql 的wait_timeout 参数设置100s,又引发出 Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. 这个问题,原因是,这个sleep 超时自动释放,但是代码里面刚好在释放前拿到这个空闲连接,导致sql执行的时候丢失链接 报错,所以解决方案是配置少的jdbc连接数

2.负载问题,删除进程sql

show PROCESSLIST

kill 33840929

select * from information_schema.processlist where user='jxmoney' and state = '' and time > 1000 order by time asc

select * from information_schema.processlist where user='jxmoney' and time > 50

select concat('KILL ',id,';') from information_schema.processlist where user='jxmoney' and time > 50

SELECT CONCAT('kill ',id,';') AS KillSQL FROM information_schema.PROCESSLIST WHERE info LIKE
'%Alert table%'

3.ASCII问题

手机号不对的问题
SELECT id,ASCII(user_account),length(user_account) c,u.user_account from back_user u where length(user_account) > 12

image.png

你可能感兴趣的:(遇到的问题)