/etc/init.d/mysql restart
lsof | grep /home/mysql ... mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock mysqld 24349 mysql 6u REG 8,33 2048 30425188 /home/mysql/mysql/host.MYI mysqld 24349 mysql 7u REG 8,33 0 30425189 /home/mysql/mysql/host.MYD mysqld 24349 mysql 8u REG 8,33 2048 30425153 /home/mysql/mysql/user.MYI mysqld 24349 mysql 9u REG 8,33 892 30425155 /home/mysql/mysql/user.MYD mysqld 24349 mysql 10u REG 8,33 5120 30425126 /home/mysql/mysql/db.MYI mysqld 24349 mysql 11u REG 8,33 3080 30425148 /home/mysql/mysql/db.MYD mysqld 24349 mysql 12u REG 8,33 4096 30425154 /home/mysql/mysql/tables_priv.MYI mysqld 24349 mysql 13u REG 8,33 0 30425157 /home/mysql/mysql/tables_priv.MYD mysqld 24349 mysql 14u REG 8,33 4096 30425143 /home/mysql/mysql/columns_priv.MYI mysqld 24349 mysql 15u REG 8,33 0 30425156 /home/mysql/mysql/columns_priv.MYD mysqld 24349 mysql 16u REG 8,33 4096 30425127 /home/mysql/mysql/procs_priv.MYI mysqld 24349 mysql 17u REG 8,33 0 30425136 /home/mysql/mysql/procs_priv.MYD mysqld 24349 mysql 18u REG 8,33 1024 30425173 /home/mysql/mysql/servers.MYI mysqld 24349 mysql 19u REG 8,33 0 30425174 /home/mysql/mysql/servers.MYD mysqld 24349 mysql 20u REG 8,33 2048 30425182 /home/mysql/mysql/event.MYI mysqld 24349 mysql 21u REG 8,33 0 30425183 /home/mysql/mysql/event.MYD ...
mysql>show global status like 'open_%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | Open_files | 17 | | Open_streams | 0 | | Open_table_definitions | 15 | | Open_tables | 8 | | Opened_files | 52 | | Opened_tables | 15 | +------------------------+-------+
mysql>flush tables; mysql> show global status like 'open_%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | Open_files | 1 | | Open_streams | 0 | | Open_table_definitions | 0 | | Open_tables | 0 | | Opened_files | 52 | | Opened_tables | 15 | +------------------------+-------+
lsof | grep /home/mysql ... mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock mysqld 24349 mysql 22u unix 0x00000102378ff980 4244128 /home/mysql/mysql.sock ...
table_cache (新版本改成了 table_open_cache) The number of cached open tables. open_files_limit If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.
ulimit -n 65535
vi /etc/my.cnf ... open_files_limit = 10000 ...
/etc/init.d/mysql restart
mysql>show global variables like '%open%'; | open_files_limit | 65535 | | table_open_cache | 1000 |
vi /etc/my.cnf ... #open_files_limit = 10000 ...
/etc/init.d/mysql restart
mysql>show global variables like '%open%'; | open_files_limit | 65535 | | table_open_cache | 1000 |
| max_connections | 100 | | table_open_cache | 1000 |
max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100 max_open_files_2 = max_connections*5 = 100 * 5 = 500
unlimit -n 5000
vi /etc/my.cnf ... open_files_limit = 10000 ...
/etc/init.d/mysql restart
mysql>show global variables like '%open%'; | open_files_limit | 10000 | | table_open_cache | 1000 |
vi /etc/my.cnf ... #open_files_limit = 10000 ...
/etc/init.d/mysql restart
mysql>show global variables like '%open%'; | open_files_limit | 5000 | | table_open_cache | 1000 |
uname -a Linux s1.yejr.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux mysql> select version(); +---------------+ | version() | +---------------+ | 5.1.23-rc-log | +---------------+
本文出自 “MySQL中文网”博客 http://www.imysql.cn/
本文出自 “爱MySQL” 博客,转载请与作者联系!