LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-25-2013, 01:09 PM   #1
Tarikc
Member
 
Registered: May 2009
Distribution: CentOS, RedHat, Ubuntu
Posts: 68

Rep: Reputation: 4
I can't increase open files limit for mysql above 1024


Hey everybody,

I just can't do it, I tried everything - I think - as below:

edited my.cnf:
Code:
[mysqld]
open_files_limit=5000
edited limits.conf
Code:
mysql           soft    nofile          24000
mysql           hard    nofile          32000
su - mysql bash
and ulimit -n 5000

All did not went well.

My file-max under proc/sys is good
Code:
cat /proc/sys/fs/file-max 
2336101
Can somebody please tell me what can I do to go over the 1024 limit?

Oh and I've also did it from mysql command line:

Code:
set open_files_limit = 5000;
ERROR 1238 (HY000): Variable 'open_files_limit' is a read only variable
Also rebooted the server after setting these limits, but without any help.

Any suggestion please?
 
Old 01-25-2013, 02:30 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
I think you are out of luck. The upper limit for most software using the select system call is 1024 files.

The reason I mention select is that when a server has multiple files open (as in MySQL), it traditionally uses the select system call to multiplex the file I/O.

I don't think MySQL is using the poll system call instead - it takes a bit more programming to get it to work, and select is simpler, though more limited (you have to build an array of file descriptors + events you expect, with select you just specify the fdset (a bit array) - but it only allows for simple input or output events; poll has about 8 different events possible).
 
Old 01-25-2013, 09:14 PM   #3
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
You may have to alter the default profile to allow ulimit to be used. What Distro are you using?
 
Old 01-25-2013, 10:06 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It would appear that the op did that - which is why the ulimit command listed a hard limit of 32000, and a soft limit of 24000.

The only thing left is the limit on files that can be handled by select. And that is not something that can be changed easily.

1 - you have to recompile the kernel to change the allocation size
2 - you have to recompile libc to get the new limit in the include files and binaries
3 - you have to recompile all applications that use select.

The reason this is so tricky is because an fdset is a static structure. Each application compiled gets the size of the structure from the header... and the runtime (and kernel) get that limit built in.

Now applications running with a large open file limit can use more than 1024 files... They just can't use a fd greater than the limit (1024) in the fdset and select system call. This was one of the reasons the poll and epoll system calls were implemented. But a lot of legacy code exists that just don't normally use that many and never migrated to the new system calls.
 
Old 01-25-2013, 11:43 PM   #5
Tarikc
Member
 
Registered: May 2009
Distribution: CentOS, RedHat, Ubuntu
Posts: 68

Original Poster
Rep: Reputation: 4
Dear jpollard,

Thank you very much for your replies… I think it is mission impossible for me to do what you have suggested because I'm somehow mmmmm newbie , and no Tom Cruise .

It is a live system I can't bring it down.

grim76, thank you for your reply, I'm using Ubuntu 12.04.1 LTS.

I wished there is an easier way to do it.

Thank you all and best regards,
 
Old 01-29-2013, 08:30 AM   #6
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
Have you put pam_limits into your login file? There should be a line somewhere that relates to that.
 
  


Reply

Tags
mysql



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can not increase the open files (fds) ? chachi95 Linux - Newbie 2 09-26-2011 11:33 AM
upping open files from 1024 :| zmarius Slackware 5 07-01-2007 10:31 PM
Setting ulimit to increase # of open files dieyouspammer Slackware 6 02-01-2006 02:42 AM
the 1024 cylinder limit visited... ngjunkie0011 SUSE / openSUSE 5 07-04-2005 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration