数据库连接超时 Connection is not available, request timed out after 30000ms
数据库连接超时
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:
Failed to obtain JDBC Connection;
nested exception is java.sql.SQLTransientConnectionException:
HikariPool-1 - Connection is not available, request timed out after 30000ms
原因
线上一条 ALTER TABLE table_name MODIFY COLUMN ...事务未提交,造成阻塞
解决(云mysql直接查看告警事件,自建优先show processlist)
查到影响mysql连接的主要原因
kill 掉阻塞的sql
分析
生产环境并发大,业务库在高峰期执行表级别的操作会导致数据库级别的问题;权限一定要控制好,添加修改字段、添加修改索引、尤其是大表或者更新频繁的表