- 浏览: 49589 次
- 性别:
文章分类
最新评论
RHEL\CentOS 7 下 MySQL 连接数被限制为214个
Way Lau's Personal Site 2015-07-09 273 阅读
mysql centos CentOS MySQL
问题
项目中,由于连接数过多,提示“Too many connections”,需要增加连接数。我在 /etc/my.cnf 中修改了
max_connections = 2000
但是, 实际连接数一直被限制在 214
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
row in set
MySQL max_connections 总是 214 。不能设大了?
环境
CentOS 7.1
MySQL 5.6.25
思考
如果我设置连接小于214时,比如 200,那么实际连接数就是 200,也就是说,我的配置文件是没有问题的。
查 MySQL 官方文档,里面说了
The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform, the amount of RAM available, how much RAM is used for each connection, the workload from each connection, and the desired response time. Linux or Solaris should be able to support at 500 to 1000 simultaneous connections routinely and as many as 10,000 connections if you have many gigabytes of RAM available and the workload from each is low or the response time target undemanding. Windows is limited to (open tables × 2 + open connections) < 2048 due to the Posix compatibility layer used on that platform.
Increasing open-files-limit may be necessary. Also see Section 2.5, “Installing MySQL on Linux”, for how to raise the operating system limit on how many handles can be used by MySQL.
大概意思是 MySQL 能够支持的最大连接数量受限于操作系统,必要时可以增大 open-files-limit 。换言之,连接数与文件打开数有关。
解决
执行
[root@emsc ~]# ulimit -n
可知,操作系统最大文件描述符限制为 1024, 在 配置文件中添加
open_files_limit = 65535
实际上也没有生效
更改 MySQL 在 Linux 的最大文件描述符限制,编辑 /usr/lib/systemd/system/mysqld.service 文件,在文件最后添加:
LimitNOFILE=65535
LimitNPROC=65535
保存后,执行下面命令,使配置生效
$ systemctl daemon-reload
$ systemctl restart mysqld.service
实际连接数到 2000 了,解决
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
row in set
参考
http://dev.mysql.com/doc/refman/5.7/en/too-many-connections.html
http://www.oschina.net/question/853151_241231
Way Lau's Personal Site 2015-07-09 273 阅读
mysql centos CentOS MySQL
问题
项目中,由于连接数过多,提示“Too many connections”,需要增加连接数。我在 /etc/my.cnf 中修改了
max_connections = 2000
但是, 实际连接数一直被限制在 214
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
row in set
MySQL max_connections 总是 214 。不能设大了?
环境
CentOS 7.1
MySQL 5.6.25
思考
如果我设置连接小于214时,比如 200,那么实际连接数就是 200,也就是说,我的配置文件是没有问题的。
查 MySQL 官方文档,里面说了
The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform, the amount of RAM available, how much RAM is used for each connection, the workload from each connection, and the desired response time. Linux or Solaris should be able to support at 500 to 1000 simultaneous connections routinely and as many as 10,000 connections if you have many gigabytes of RAM available and the workload from each is low or the response time target undemanding. Windows is limited to (open tables × 2 + open connections) < 2048 due to the Posix compatibility layer used on that platform.
Increasing open-files-limit may be necessary. Also see Section 2.5, “Installing MySQL on Linux”, for how to raise the operating system limit on how many handles can be used by MySQL.
大概意思是 MySQL 能够支持的最大连接数量受限于操作系统,必要时可以增大 open-files-limit 。换言之,连接数与文件打开数有关。
解决
执行
[root@emsc ~]# ulimit -n
可知,操作系统最大文件描述符限制为 1024, 在 配置文件中添加
open_files_limit = 65535
实际上也没有生效
更改 MySQL 在 Linux 的最大文件描述符限制,编辑 /usr/lib/systemd/system/mysqld.service 文件,在文件最后添加:
LimitNOFILE=65535
LimitNPROC=65535
保存后,执行下面命令,使配置生效
$ systemctl daemon-reload
$ systemctl restart mysqld.service
实际连接数到 2000 了,解决
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
row in set
参考
http://dev.mysql.com/doc/refman/5.7/en/too-many-connections.html
http://www.oschina.net/question/853151_241231
发表评论
-
linux下sftp配置
2018-03-28 09:59 934linux centos7下sftp配置 Linux环境下自带 ... -
mysql 查询慢日志
2018-03-20 15:21 3741、对mysql 开启慢查询,可以让MySQL记录下查询超过指 ... -
centos6.5 下nginx的部署填各种坑
2018-01-18 17:42 21921、本人第一次安装nginx; nginx下载路径http: ... -
linux 下awk的应用
2017-12-28 17:16 696引用文章http://www.jb51.net/article ... -
mysql触发器
2017-08-08 16:03 312mysql触发器语法: CREATE ... -
MySQL自定义函数用法详解
2017-08-08 14:47 469自定义函数 (user-defined function UD ... -
Mysql创建函数不成功异常问题
2017-08-08 14:45 340函数创建异常: [Err] 1418 - This fun ... -
linux 查看系统版本
2017-04-01 10:39 289shell命令1:lsb_release -a 适用于所有的 ... -
linux下修改war包
2017-03-06 15:32 1031Linux上修改war包上的文件 www.MyExceptio ... -
Shell遍历properties文件里面的 key和value
2017-03-06 15:31 0#!/bin/ksh IFS='=' while ... -
centos7系统下网络配置
2016-12-30 15:11 4421、检查网卡 [root@localhost ~]# ip ... -
linux下resin的https配置
2016-12-27 17:47 862对于resin官方版本对接openssl有个坑;把我差点坑死了 ... -
linux下ftp搭建
2016-12-16 16:35 2591.检查linux是否安装了ftp命令:rpm -qa|gre ... -
nexus maven私有库搭建
2016-12-12 18:12 3811.下载nexus包,linux命令 wget http:/ ... -
linux sed命令
2016-11-30 11:29 276简介 sed 是一种在线编辑器,它一次处理一行内容。处理时, ... -
intellij idea 下resin容器远程调试
2016-11-16 09:27 5302resin远程调试(我使用的是resin-4.0.41版本): ... -
Hive-1.2.1 HWI 图形化界面问题
2016-10-27 15:16 4861、下载apache-hive-1.2.1-src.tar.g ... -
Linux下免密码登陆ssh
2016-10-21 11:14 246第一步:ssh-keygen 创建公钥和密钥 [root@ji ... -
Mysql 中LEFT中on与where 过滤条件差异
2015-08-28 17:02 1732语句1: SELECT a.id, b.id FROM a L ... -
Linux下查看系统的位数和系统信息
2015-05-15 00:58 1392对于linux系统,,安装一些软件,,有时候要考虑到linux ...
相关推荐
windows系统下mysql5.5.23,里边包含mysql安装文件和安装详细步骤说明
Activiti框架 经典5.23 RC1
ROS 5.23 中文版登陆器
智能abc 5.23 智能abc 5.23 智能abc 5.23 智能abc 5.23 智能abc 5.23 智能abc 5.23 智能abc 5.23 智能abc 5.23
精易模块5.23, 精易模块5.23, 精易模块5.23, 精易模块5.23,
精易模块 V5.23 what’s new:(2015XXXX) 1、新增“进程_取父ID”,根据进程名或进程ID取出进程父ID,失败返回-1。 2、改善“外部超级列表框_自动调整列宽”最后一列会自动补齐的问题,感谢易友【@茶酷儿 】反馈。...
PHP环境配置,环境为IIS5.0+PHP5.23+MYSQL5+phpMyAdmin
第五章 多电子原子5.23.pptx
Activiti-5.23.0-release源代码,20200608下载于github。 Activiti项目是一项新的基于Apache许可的开源BPM平台,从基础开始构建,旨在提供支持新的BPMN 2.0标准,包括支持对象管理组(OMG),面对新技术的机遇,...
UFS Explorer专业版恢复5.23 +破解,啥也不多说了,懂的人都知道,安装原程序后将补丁放到安装目录,运行即可,如果不成功,手动打开破解软件,将生成的激活码复制到软件即可
java解析DICOM文件需要的jar包,包括dcm4che-core-5.23.3.jar、dcm4che-image-5.23.3.jar、dcm4che-imageio-opencv-5.23.3.jar。等
空间精灵5.23V
智能ABC V5.23
智能ABC V5.23 特别版(第二版).rar智能ABC V5.23 特别版(第二版).rar智能ABC V5.23 特别版(第二版).rar智能ABC V5.23 特别版(第二版).rar
在下载区没有找到最新idea的checkstyle的最新插件,在官网下载了最新版5.23.0,截止18/12/21属于最新版本。分享给大家。
MDK最新5.23(2017.02)下载地址
硬盘坏道专业扫描工具Victoria5.23
智能ABC5.23输入法 windows
老版ABC输入法光盘移植出来的,WIN7可以直安装