我已在 my.cnf 文件中将最大连接数设置为 2000 左右。
max_connections=2048
Run Code Online (Sandbox Code Playgroud)
我已升级到 5.5.20,现在我在错误日志中看到以下行。
120201 19:40:24 [Warning] Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 400
Run Code Online (Sandbox Code Playgroud)
为什么 mysql 将最大连接值更改为 214 ?
# mysqladmin variables | grep max_connections
| max_connections | 214
Run Code Online (Sandbox Code Playgroud)
操作系统限制的软硬打开文件为1024
# ulimit -Sa | grep "open files"
open files (-n) 1024
# ulimit -Ha | grep "open files"
open files (-n) 1024
Run Code Online (Sandbox Code Playgroud)
实际使用的最大连接数:
# mysql -e"show status like '%used_connections%'"
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 95 |
+----------------------+-------+
Run Code Online (Sandbox Code Playgroud)
小智 5
尽管我使用的是 CentOS 7 和 MySQL 5.6.26,但这似乎与我在此处的 stackoverflow 中回答的问题相同
您需要提高 mysql 用户(在limits.conf 中)和mysql 服务(在mysql.service 文件中)的打开文件限制
将这两行附加到 /etc/security/limits.conf
mysql hard nofile 65535
mysql soft nofile 65535
Run Code Online (Sandbox Code Playgroud)
将此行附加到 /usr/lib/systemd/system/mysqld.service (在 [service] 部分)
LimitNOFILE=65535
Run Code Online (Sandbox Code Playgroud)
然后最后重新启动并检查这些错误消息是否已从您的 mysql 错误日志中消失。
归档时间: |
|
查看次数: |
30703 次 |
最近记录: |