【发布时间】:2020-05-22 12:45:07
【问题描述】:
我有著名的socketexception too many open files 错误。
我正在我的服务器上运行一个 apache http 服务器、tomcat 服务器和一个 mysql 数据库。
我使用ulimit -n 检查了打开文件的限制,结果为 1024。
如果我想检查lsof -u tomcat 打开了多少文件,它给了我 5
对 mysql 也一样。我不确定问题是什么。但我也拒绝了读取链接权限。
我想监控我的套接字连接并在我的服务器上打开文件。我考虑过在 shell 脚本中使用所描述的 linux 命令并通过邮件将它们发送给我。
我认为的另一个选项是使用netstat 并可能计算连接数.. 但它的加载速度非常慢,并且让我 getnameinfo 失败。
监视我的错误的更好命令是什么?
编辑:
SHOW GLOBAL VARIABLES LIKE '%open%';
Variable_name Value
Com_ha_open 0
Com_show_open_tables 0
Open_files 8
Open_streams 0
Open_table_definitions 87
Open_tables 64
Opened_files 673
Opened_table_definitions 87
Opened_tables 628
Slave_open_temp_tables 0
SHOW GLOBAL VARIABLES LIKE '%open%';
Variable_name Value
have_openssl DISABLED
innodb_open_files 300
open_files_limit 2000
table_open_cache 64
SHOW GLOBAL VARIABLES LIKE '%connect%'
character_set_connection latin1
collation_connection latin1_swedish_ci
connect_timeout 10
init_connect
max_connect_errors 10
max_connections 400
max_user_connections 0
SHOW GLOBAL STATUS LIKE '%connect%';
Variable_name Value
Aborted_connects 1
Connections 35954
Max_used_connections 102
Ssl_client_connects 0
Ssl_connect_renegotiates 0
Ssl_finished_connects 0
Threads_connected 11
【问题讨论】:
-
使用 MySQL 客户端登录,发布 A) SHOW GLOBAL VARIABLES LIKE '%open%'; 的 TEXT 结果;和 B) 显示全局变量,例如 '%open%';和 C) 显示全局变量,例如 '%connect%';和 D) 显示 '%connect%' 之类的全局状态;请。
-
你能制定一个好的答案并格式化吗?也可能是命令的一些注释。 TY ;)
-
显示全局变量,例如 '%open%';
-
显示全局状态,如 '%open%'
-
显示全局变量,例如 '%connect%';
标签: linux sockets tomcat netstat ulimit