How MySQL Opens and Closes Tables refuse connections 拒绝连接的原因 file descriptors
MySQL :: MySQL 5.7 Reference Manual :: 8.4.3.1 How MySQL Opens and Closes Tables https://dev.mysql.com/doc/refman/5.7/en/table-cache.html
8.4.3.1 How MySQL Opens and Closes Tables
When you execute a mysqladmin status command, you should see something like this:
Uptime: 426 Running threads: 1 Questions: 11082
Reloads: 1 Open tables: 12
The Open tables
value of 12 can be somewhat puzzling if you have only six tables.
MySQL is multi-threaded, so there may be many clients issuing queries for a given table simultaneously. To minimize the problem with multiple client sessions having different states on the same table, the table is opened independently by each concurrent session. This uses additional memory but normally increases performance. With MyISAM
tables, one extra file descriptor is required for the data file for each client that has the table open. (By contrast, the index file descriptor is shared between all sessions.)
The table_open_cache
and max_connections
system variables affect the maximum number of files the server keeps open. If you increase one or both of these values, you may run up against a limit imposed by your operating system on the per-process number of open file descriptors. Many operating systems permit you to increase the open-files limit, although the method varies widely from system to system. Consult your operating system documentation to determine whether it is possible to increase the limit and how to do so.
table_open_cache
is related to max_connections
. For example, for 200 concurrent running connections, specify a table cache size of at least 200 *
, where N
N
is the maximum number of tables per join in any of the queries which you execute. You must also reserve some extra file descriptors for temporary tables and files.
Make sure that your operating system can handle the number of open file descriptors implied by the table_open_cache
setting. If table_open_cache
is set too high, MySQL may run out of file descriptors and refuse connections, fail to perform queries, and be very unreliable.
0-连接数不够:软件,增大max_connections;
1-系统资源不足:硬件,file descriptors 不足,改善硬件(增大 --open-files-limit
)。
You should also take into account the fact that the MyISAM
storage engine needs two file descriptors for each unique open table. For a partitioned MyISAM
table, two file descriptors are required for each partition of the opened table. (Note further that when MyISAM
opens a partitioned table, it opens every partition of this table, whether or not a given partition is actually used. See MyISAM and partition file descriptor usage.) You can increase the number of file descriptors available to MySQL using the --open-files-limit
startup option to mysqld. SeeSection B.5.2.17, “File Not Found and Similar Errors”.
The cache of open tables is kept at a level of table_open_cache
entries. The server autosizes the cache size at startup. To set the size explicitly, set the table_open_cache
system variable at startup. Note that MySQL may temporarily open more tables than this to execute queries.
MySQL closes an unused table and removes it from the table cache under the following circumstances:
When the cache is full and a thread tries to open a table that is not in the cache.
When the cache contains more than
table_open_cache
entries and a table in the cache is no longer being used by any threads.When a table flushing operation occurs. This happens when someone issues a
FLUSH TABLES
statement or executes a mysqladmin flush-tables or mysqladmin refresh command.
How MySQL Opens and Closes Tables refuse connections 拒绝连接的原因 file descriptors的更多相关文章
- HOW MYSQL USES INTERNAL TEMPORARY TABLES
HOW MYSQL USES INTERNAL TEMPORARY TABLES Table of Contents [hide] 1)UNION queries 2)Some views 3)SQL ...
- Nagios显示器mysql定从库: libmysqlclient.so.18: cannot open shared object file: No such
做mysql的slave时间监控,必须check_mysql文字,check当误差: error while loading shared libraries: libmysqlclient.so.1 ...
- Apache Tomcat/6.0.39如何配置连接mysql,JDBC:mysql-connector-java-5.1.30-bin.jar-成功连接心得
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 前提:开启TOMCAT,MYsql MySQL ...
- 解决 phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接 问题
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 问题解决办法: 修改co ...
- MySQL多表查询之外键、表连接、子查询、索引
MySQL多表查询之外键.表连接.子查询.索引 一.外键: 1.什么是外键 2.外键语法 3.外键的条件 4.添加外键 5.删除外键 1.什么是外键: 主键:是唯一标识一条记录,不能有重复的,不允许为 ...
- phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 错误产生原因: 修改了 ...
- 以Tomcat+Mysql为例,实现Docker多容器连接
Docker提供了多个容器直接访问的方法,最简单的方式是直接使用端口映射-p参数指定映射的端口或者-P映射所有端口,多个容器直接通过网络端口进行访问. 但网络端口映射方式并不是Docker中连接多个容 ...
- Mac OS本地,XAMPP,出现 “phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接”错误
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 原因一:有可能是因为修改 ...
- MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式
一.MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式 1.本地数据库连接Driver={MySQL};Server=localhost;Option=16834; ...
随机推荐
- 【Android】页面迁移时先弹出键盘问题解决
android自动弹出软键盘(输入键盘) 在AndroidMainfest.xml内容无法更改情况下,也就是键盘非要弹出情况下,进入此页面时先关闭软键盘不让其弹出 InputMethodManager ...
- 一个java定时器框架
ScheduleIterator接口 import java.util.Date; public interface ScheduleIterator { public Date next(); ...
- iOS 收款计算器算法
一个收款计算器算法,从之前高仿有赞Demo里面抽离的一个界面 demo 在这里 https://github.com/L-vinCent/calculView_function 显示计算记录 不能连续 ...
- 线段树练习5(codevs 4927)
题目描述 Description 有n个数和5种操作 add a b c:把区间[a,b]内的所有数都增加c set a b c:把区间[a,b]内的所有数都设为c sum a b:查询区间[a,b] ...
- KVM 网络虚拟化基础
网络虚拟化是虚拟化技术中最复杂的部分,学习难度最大. 但因为网络是虚拟化中非常重要的资源,所以再硬的骨头也必须要把它啃下来. 为了让大家对虚拟化网络的复杂程度有一个直观的认识,请看下图 这是 Open ...
- Yii2之创建定时任务
yii开发的项目需要使用定时任务其实也可以使用一些单独的脚本文件来完成,但若是定时任务代码中需要使用到项目中的一些类,特别是需要使用应用对象Yii::$app的时候,单独的脚本想要完成就比较麻烦了.这 ...
- OC-为何用copy修饰block
简单来说,block就像一个函数指针,指向我们要使用的函数. 就和函数调用一样的,不管你在哪里写了这个block,只要你把它放在了内存中(通过调用存在这个block的方 法或者是函数),不管放在栈中还 ...
- 快速掌握RabbitMQ(四)——两种消费模式和QOS的C#实现
本篇介绍一下RabbitMQ中的消费模式,在前边的所有栗子中我们采用的消费者都是EventingBasicConsumer,其实RabbitMQ中还有其他两种消费模式:BasicGet和QueueBa ...
- ZOJ - 4016 Mergeable Stack (STL 双向链表)
[传送门]http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4016 [题目大意]初始有n个空栈,现在有如下三种操作: (1) ...
- 更改bootstrap的默认样式
很久没用bootstrap,对与按自己的需求修改样式都忘了. 一上来就添加了新的class类,重写css样式让其覆盖原有的样式,实际上不起作用.因为没考虑的选择器的优先级.面试的时候会问到一些这个问题 ...