一,连接数相关监控
sql查询命令:
show status like '%connect%';
show variables like 'max_connections';
参数介绍:
Aborted_connects 尝试连接到MySQL服务器失败的次数,
Connections 表示MySQL从启动至今,成功建立连接的连接数,这个值是不断累加的
max_connect_errors 允许单用户连接错误最大值,超过后在不刷新状态的情况下,禁止该用户新连接
max_connections 实例最大连接数限制
max_user_connections 某个用户并行占用的最大连接数
max_user_connections_time 用户占用最大连接数的用户发生的时间点
Threads_connected 这个数值指的是打开的连接数.
Connection_errors_max_connections 因为max_connections限制而连接失败的连接
调优指南
1,根据max_user_connections的值设置max_connections的值,
max_user_connections/max_connections = 85%
2, set global max_connections = 200;//设置最大连接数
二,线程数相关监控
sql查询命令
show global status like '%thread%';
show variables like 'thread%';
参数介绍:
Threads_cached 代表当前此时此刻线程缓存中的空闲线程
Threads_connected 代表当前建立的连接数
Threads_created 最近一次服务启动以来,创建的线程数量
Threads_running 前激活的(非睡眠)的线程
thread_cache_size最好设置成和threads_connected一样。不过很少将thread_cache_size设置成比200大。
set global thread_cache_size=200