Автор Тема: Mysql open_files_limit Ubuntu  (Прочетена 16853 пъти)

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Mysql open_files_limit Ubuntu
« -: Feb 21, 2010, 15:23 »
Здравейте,

Имам един VPS с Ubuntu hardy, Kernel 2.6.24-26-virtual, HDD 40 GB, 2 GB RAM, CPU Intel(R) Xeon(R) E5405  @ 2.00GHz. Въпросния сървър се ползва за хостинг на сайта ми и на него има работещо Apache mod_worker със cgi-php (fcgi) и Mysql 5.0.51. Сървъра се претоварваше заради лошо конфигуриран mysql. С помощта на този скрипт успях да направя тази конфигурация на mysql-а:
Цитат
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port      = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice      = 0
open_files_limit = 8192

[mysqld]
#
# * Basic Settings
#

#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user      = mysql
pid-file   = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port      = 3306
basedir      = /usr
datadir      = /var/lib/mysql
tmpdir      = /tmp
language   = /usr/share/mysql/english
skip-external-locking
open_files_limit = 8192
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address      = 127.0.0.1
#
# * Fine Tuning
#
key_buffer            = 256M
join_buffer            = 4M
max_allowed_packet      = 128M
thread_stack         = 128K
thread_cache_size      = 128
max_connections           = 64
table_cache               = 2048
sort_buffer_size      = 2M
read_buffer_size      = 2M
read_rnd_buffer_size   = 4M
thread_concurrency      = 2
innodb_thread_concurrency =0
#
# * Query Cache Configuration
#
query_cache_limit       = 2M
query_cache_size        = 64M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log      = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
log_slow_queries   = /var/log/mysql/mysql-slow.log
long_query_time = 5
log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin         = /var/log/mysql/mysql-bin.log
expire_logs_days   = 10
max_binlog_size         = 100M
#binlog_do_db      = include_database_name
#binlog_ignore_db   = include_database_name
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet   = 16M

[mysql]
#no-auto-rehash   # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 64M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/


Проблема ми е следния въпреки че в my.cnf съм казал open_files_limit = 8192, като дам:
Цитат
mysqladmin -u root -pnqkakvaparola variables |grep open_files_limit
получавам:
Цитат
| open_files_limit                | 1024

Също така въпреки че съм дал table_cache = 2048 получавам следното нещо:
Цитат
mysqladmin -u root -pnqkakvaparola variables |grep table_cache
| table_cache                     | 475

Някой знае ли как да ги вдигна тези лимити до стойностите дадени в my.cnf? Предварително благодаря!

P.S> Задал съм в sysctl.conf съм задал fs.file-max = 200000 в  /etc/security/limits.conf добавих
Цитат
mysql           soft    nofile  16384
mysql           hard    nofile  16384
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

anstas

  • Напреднали
  • *****
  • Публикации: 160
  • Distribution: Debian Mandriva Sabayon
  • Window Manager: Gnome & KDE
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #1 -: Feb 21, 2010, 16:20 »
Здравей!

http://unixtoolbox.vladimirkolev.com/unixtoolbox.xhtml#sysinfo

В точка 1.4 има обяснение по въпроса...

ulimit командата може да се използва в скрипт, за да промени границите само за скрипта.

Успех!
« Последна редакция: Feb 21, 2010, 16:22 от anstas »
Активен

Ако Господ се бе посъветвал с мен, когато е  създавал света,  щях да му препоръчам да го устрои по-просто.     Алфонс X МЪДРИ, крал на Кастилия.

GNU/Linux user 462005

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #2 -: Feb 21, 2010, 20:35 »
Благодаря за полезния линк. Но не си отговарям на въпроса какво трябва да направя още? Нали на mysql юзера в /etc/security/limits.conf  съм разрешил да отваря 16384 файла в my.cnf  съм дал 8192 пробвах и със 16384 но резултата беше никакъв. mysqladmin-а продължава да ми показва че лимита ми е 1024.

На правилните места в my.cnf ли задавам open_files_limit? Защото като зададох нещата така:
Цитат
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice      = 0
open_files_limit = 16384

[mysqld]
#
# * Basic Settings
#

#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user      = mysql
pid-file   = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port      = 3306
basedir      = /usr
datadir      = /var/lib/mysql
tmpdir      = /tmp
language   = /usr/share/mysql/english
skip-external-locking
open_files_limit = 16384

Mysql-а тръгна но при опит да отворя сайта си получавах:
Цитат
Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 78

Warning: MySQL error: Can't open file: './sexkupon/sexkupon_admin.frm' (errno: 24)
in query: SELECT `admin_id` FROM `sexkupon_admin` WHERE `admin_username`='admin' AND `admin_password`='nqkakvaparola'
in /var/sites/sexkupon.com/internals/SK6_inc/class.mysql.php on line 299


Когато зададох нещата така:
Цитат
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice      = 0
open_files_limit = 16384

[mysqld]
#
# * Basic Settings
#

#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user      = mysql
pid-file   = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port      = 3306
basedir      = /usr
datadir      = /var/lib/mysql
tmpdir      = /tmp
language   = /usr/share/mysql/english
skip-external-locking
#open_files_limit = 16384
Всичко работеше нормално но mysqladmin -u root -pnqkakvaparola variables |grep open_files_limit
казваше
Цитат
| open_files_limit                | 1024
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

Ivan_storm

  • Напреднали
  • *****
  • Публикации: 35
  • Distribution: Debian stable
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #3 -: Feb 21, 2010, 21:51 »
здр, 
В фаила  /etc/security/limits.conf     сложи този ред 
root         -       nofile              16384
Активен

Pentium + Debian GNU/Linux - he fights for us.

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #4 -: Feb 22, 2010, 10:17 »
Добавих го това, грешките при отваряне на сайта изчезнаха но според mysqladmin лимита пак си остана на 1024
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

dejuren

  • Напреднали
  • *****
  • Публикации: 1025
  • Distribution: Ubuntu, RedHat
  • Window Manager: lxde KDE4
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #5 -: Feb 22, 2010, 22:44 »
А през рестарт на mysql сървъра мина ли?
Активен

http://webchat.freenode.net/?channels=ubuntu-bg
The quieter you become, the more you are able to hear.
Две седмици цъкане с мишката спестяват два часа четене на документацията.

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #6 -: Feb 22, 2010, 22:52 »
Разбира се че съм минал. След всяка промяна давам рестарт на mysql-а.
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

borovaka

  • Напреднали
  • *****
  • Публикации: 1331
  • Distribution: Каквото дойде
  • Window Manager: Gnome / KDE
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #7 -: Feb 22, 2010, 23:04 »
abadon Погледни тук:
http://www.listsearch.com/MySQL/Thread/index.lasso?80536
Човека има същия проблем и са го решили посредством ulimit както ти каза anstas.
Разгледай дано да ти помогне.
Активен

Та извода е прост: "Колкото по-големи ла*ната - толкова по-малка щетата! ... моралната де, не материалната"

dejuren

  • Напреднали
  • *****
  • Публикации: 1025
  • Distribution: Ubuntu, RedHat
  • Window Manager: lxde KDE4
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #8 -: Feb 22, 2010, 23:06 »
Пробвай да го спреш и пуснеш ръчно с:
Код:
mysqld --open_files_limit=12345
Ако не стане проблемът ще е с ulimit/sysctl
Активен

http://webchat.freenode.net/?channels=ubuntu-bg
The quieter you become, the more you are able to hear.
Две седмици цъкане с мишката спестяват два часа четене на документацията.

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #9 -: Feb 23, 2010, 10:34 »
Пробвай да го спреш и пуснеш ръчно с:
Код:
mysqld --open_files_limit=12345
Ако не стане проблемът ще е с ulimit/sysctl

Пробвах го и ми даде това:
Цитат
root@www:~# mysqld --open_files_limit=8192
100223 10:24:12 [Warning] Could not increase number of max_open_files to more than 1024 (request: 4170)
100223 10:24:12  InnoDB: Started; log sequence number 0 3296319
100223 10:24:13 [Note] mysqld: ready for connections.
Version: '5.0.51a-3ubuntu5.4-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

@borovaka благодаря за линка сетнах ulimit -n 16384 в /etc/init.d/mysql и всичко работи.

Ако някой знае как се сетват тези лимити глобално да казва, защото това все пак си е луркараунд. И искам да си ги настроя нещата както си му е реда.
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

borovaka

  • Напреднали
  • *****
  • Публикации: 1331
  • Distribution: Каквото дойде
  • Window Manager: Gnome / KDE
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #10 -: Feb 23, 2010, 10:54 »
В rc.local ако го добавиш ми се струва, че ще е глобално.
А дори и да е в mysql  демона пак си става глобално след като се изпълни при стартиране.
Активен

Та извода е прост: "Колкото по-големи ла*ната - толкова по-малка щетата! ... моралната де, не материалната"

dejuren

  • Напреднали
  • *****
  • Публикации: 1025
  • Distribution: Ubuntu, RedHat
  • Window Manager: lxde KDE4
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #11 -: Feb 23, 2010, 18:10 »
Цитат
To check and modify system limits.

[The current limit shown is 8192]
% cat /proc/sys/fs/file-max
8192

[To increase this to 65535 (as root)]
# echo "65535" > /proc/sys/fs/file-max

If you want this new value to survive across reboots you can at it to /etc/sysctl.conf

# Maximum number of open files permited
fs.file-max = 65535

Note: that this isn't proc.sys.fs.file-max as one might expect.

To list the available parameters that can be modified using sysctl do

% sysctl -a

To load new values from the sysctl.conf file.

% sysctl -p /etc/sysctl.conf
Източник:uwaterloo.ca: Increasing the number of open file descriptors
Активен

http://webchat.freenode.net/?channels=ubuntu-bg
The quieter you become, the more you are able to hear.
Две седмици цъкане с мишката спестяват два часа четене на документацията.

VladSun

  • Напреднали
  • *****
  • Публикации: 2166
    • Профил
Re: Mysql open_files_limit Ubuntu
« Отговор #12 -: Feb 23, 2010, 18:50 »
Според мен table_cache параметърът ти е много голям.
Цитат
table_cache is related to max_connections. For example, for 200 concurrent running connections, you should have a table cache size of at least 200 × N, where 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.

Ти имаш max_connections = 64, значи N ти е 32 ... 32 таблици JOIN-ваш в заявка?!? Не бих казал ;)

За четене:
http://dev.mysql.com/doc/refman/5.0/en/table-cache.html
http://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html

Успех :)
Активен

KISS Principle ( Keep-It-Short-and-Simple )
http://openfmi.net/projects/flattc/
Има 10 вида хора на този свят - разбиращи двоичния код и тези, които не го разбират :P

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #13 -: Feb 24, 2010, 10:17 »
Цитат
To check and modify system limits.

[The current limit shown is 8192]
% cat /proc/sys/fs/file-max
8192

[To increase this to 65535 (as root)]
# echo "65535" > /proc/sys/fs/file-max

If you want this new value to survive across reboots you can at it to /etc/sysctl.conf

# Maximum number of open files permited
fs.file-max = 65535

Note: that this isn't proc.sys.fs.file-max as one might expect.

To list the available parameters that can be modified using sysctl do

% sysctl -a

To load new values from the sysctl.conf file.

% sysctl -p /etc/sysctl.conf
Източник:uwaterloo.ca: Increasing the number of open file descriptors

Тези неща ги знам и съм ги проверил още преди да пиша тук.


P.S> Задал съм в sysctl.conf съм задал fs.file-max = 200000 в  /etc/security/limits.conf добавих
Цитат
mysql           soft    nofile  16384
mysql           hard    nofile  16384
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

abadon

  • Напреднали
  • *****
  • Публикации: 510
  • Distribution: Debian
  • Window Manager: KDE
    • Профил
    • WWW
Re: Mysql open_files_limit Ubuntu
« Отговор #14 -: Feb 24, 2010, 10:41 »
Според мен table_cache параметърът ти е много голям.
Цитат
table_cache is related to max_connections. For example, for 200 concurrent running connections, you should have a table cache size of at least 200 × N, where 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.

Ти имаш max_connections = 64, значи N ти е 32 ... 32 таблици JOIN-ваш в заявка?!? Не бих казал ;)

За четене:
http://dev.mysql.com/doc/refman/5.0/en/table-cache.html
http://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html

Успех :)

Сложих ги така защото така ми препоръчваше tuning-primer.sh скрипта. Тъй като имах повече отворени таблици отколкото кеша. Ето какъв ми е рапорта от него след почти денонощие работа:
Цитат
Would you like me to create a ~/.my.cnf file for you? [y/N] : n

        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.51a-3ubuntu5.4-log i486

Uptime = 0 days 23 hrs 50 min 45 sec
Avg. qps = 321
Total Questions = 27606694
Threads Connected = 2

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 5 sec.
You have 1069148 out of 27606766 that take longer than 5 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 128
Current threads_cached = 64
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 64
Current threads_connected = 1
Historic max_used_connections = 65
The number of used connections is 101% of the configured maximum.
You should raise max_connections

INNODB STATUS
Current InnoDB index space = 352 K
Current InnoDB data space = 448 K
Current InnoDB buffer pool free = 81 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 1.09 G
Configured Max Per-thread Buffers : 775 M
Configured Max Global Buffers : 330 M
Configured Max Memory Limit : 1.07 G
Physical Memory : 1.97 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 27 M
Current key_buffer_size = 256 M
Key cache miss rate is 1 : 4406
Key buffer free ratio = 84 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 8 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 13.14 %
Current query_cache_min_res_unit = 4 K
Query Cache is 30 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 3 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 4.00 M
You have had 13510 queries where a join could not use an index properly
join_buffer_size >= 4 M
This is not advised
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.

OPEN FILES LIMIT
Current open_files_limit = 16384 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 2048 tables
You have a total of 792 tables
You have 1043 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 619925 temp tables, 6% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 552 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 90
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

Сега сложих :
Цитат
max_connections           = 96
query_cache_limit        = 2M
query_cache_size         = 16M
query_cache_min_res_unit = 2K
Да видя как ще е.
Активен

Успешното Boot-ване на Windows завършва с рестарт!!!
You are registered as user #382190 with the Linux Counter
Всеки пост - отговор на въпрос

Подобни теми
Заглавие Започната от Отговора Прегледи Последна публикация
MySql малък проблем.
Хардуерни и софтуерни проблеми
Marto 6 4604 Последна публикация Sep 25, 2002, 12:32
от
Perl + CGI,DBI + Mysql ili PHP + Mysql
Общ форум
jica 3 5331 Последна публикация Sep 07, 2004, 17:02
от jica
Ubuntu live to ubuntu alternate?
Настройка на програми
Whisper 3 8791 Последна публикация Aug 30, 2007, 12:56
от bnight
Mysql проблем със стартирането(mysql.sock missing)
Настройка на програми
coveka 6 7178 Последна публикация Mar 01, 2008, 22:02
от coveka
Mysql: can't connect to local mysql server
Настройка на програми
wonder 1 5575 Последна публикация Mar 16, 2008, 01:17
от neter