LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-09-2010, 04:51 AM   #1
xiutuo
Member
 
Registered: Mar 2008
Posts: 55

Rep: Reputation: 15
ulimit -n no effect,why?


exec command
ulimit -n 65535
when i relogin ,
ulimit -a
show default values 1024

how can i let tomcat server use max file num=65535 ,when start with /tomcat_install_dir/bin/startup.sh,why ulimit -n 65535 no effect!

configure in /etc/sercurity/limits.conf or /etc/sysctl.conf ? or
/etc/profile? or any other configure file ?

thx for your hint.....
 
Old 11-09-2010, 06:44 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,223
Blog Entries: 1

Rep: Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076Reputation: 2076
Hi,

Running ulimit -n XXX, lasts only for the current session.
Depending on distro you can set it in /etc/sercurity/limits.conf or /etc/sysctl.conf, but sometimes it's not guaranteed it'll work after reboot. I had a RHEL4 box and to eliminate the problem, I had the ulimit command run through /etc/rc.local.

Anyway, you can try the methods above, but if you want to set it only for tomcat, I'd suggest to put it in /tomcat_install_dir/bin/startup.sh, so it's set only for the user that runs tomcat and only for running tomcat.

Regards
 
Old 11-09-2010, 06:48 AM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Not sure too, if it applies equally to OP's situation here, but maybe have a look over here:
http://www.linuxquestions.org/questi...e-size-822491/

The OP there needed to define the core pattern before a `ulimit -c` command would work. You may need to do the same. If you do this, make sure that somewhere in your boot scripts, `sysctl -p` is executed to make the values take effect.

EDIT: I think I misread the OP - you *do* have it working, but it is not persistent, right? Sorry about that (if that's the case), ignore this! It probably doesn't apply.

Last edited by GrapefruiTgirl; 11-09-2010 at 06:51 AM.
 
Old 11-09-2010, 07:34 PM   #4
xiutuo
Member
 
Registered: Mar 2008
Posts: 55

Original Poster
Rep: Reputation: 15
thx,i test right now,I do believe I can make it...
 
Old 11-10-2010, 03:55 AM   #5
abhandari
LQ Newbie
 
Registered: Dec 2008
Location: NP
Posts: 28

Rep: Reputation: 1
Thumbs up

Quote:
Originally Posted by xiutuo View Post
exec command
ulimit -n 65535
when i relogin ,
ulimit -a
show default values 1024

how can i let tomcat server use max file num=65535 ,when start with /tomcat_install_dir/bin/startup.sh,why ulimit -n 65535 no effect!

configure in /etc/sercurity/limits.conf or /etc/sysctl.conf ? or
/etc/profile? or any other configure file ?

thx for your hint.....

Hi xiutuo,
U have this above File Descriptor (FD) problem with SQUID as Proxy server. I don't know the kernel version of linux and squid ur using with this. One thing u must be clear that linux/CentOS/RHEL or other version of linux kernel has File Descriptor limit (makes real-time file but needs to be restricted which might hang up ur server as well with memory consumption. It get removed automatically from memory after jobs are done.) and has default limit to 1024 which is really enough for other services like smtp,ftp,imap,named etc. We can configure FD with various methods.
Following link also works,
=================
http://www.linuxquestions.org/questi...le-size-822491
=================
but problem is that FD is even used on every kernel level error and every services running on system which we really don't wan't. Gr8, what we really want? Then, specific limit for specific service for user.

Here we go for the best in my practice.Ok
=============
Check for ur current Maximum File descriptor limit in current session:
-------------
# ulimit -n
-------------
Squid only starts with a maximum of 1024 FD's
=============
#vi /etc/security/limits.conf
add the following lines ( if u have squid user u can even replace * with the squid user otherwise just leave it.)
#<domain> <type> <item> <value>
* soft nofile 65536
* hard nofile 65536
------Save N Quit--------------

#ulimit -HSn 65536 --->sets File descriptor limit for current session
# ulimit -n
---------------------
# vi /etc/sysctl.conf
-----------------
add the line at the end of the file and save it

fs.file-max = 65536
-----------------
# sysctl -a


================
then add the following line inside
#vi /etc/pam.d/login
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
account required pam_nologin.so

session required pam_limits.so ---> add this line

======Save N Quit==========
# reboot your computer
===========================
#ulimit -n ====> to check after reboot and should return 65536
set ulimit for current session if not set to 65536
===============
Boss it works enjoy.
U can get this on
http://www.ispexperts.com.np/?p=535
 
Old 11-11-2010, 03:55 AM   #6
xiutuo
Member
 
Registered: Mar 2008
Posts: 55

Original Poster
Rep: Reputation: 15
os:centos5.4
kernel:2.6.18-194.el5

tomcat log show some msg like this:

too many open files


any way,"abhandari" 's work fine...

but kernel.core_pattern=core.%e.%p only for 'ulimit -c'

thx
 
Old 11-12-2010, 12:15 AM   #7
abhandari
LQ Newbie
 
Registered: Dec 2008
Location: NP
Posts: 28

Rep: Reputation: 1
Thumbs up

Quote:
Originally Posted by xiutuo View Post
os:centos5.4
kernel:2.6.18-194.el5

tomcat log show some msg like this:

too many open files


any way,"abhandari" 's work fine...

but kernel.core_pattern=core.%e.%p only for 'ulimit -c'

thx
======
[SOLVED]
This is just warning msg since we have by default 1024 FD set by squid but we set it soft/hard FD limit to 65536 which gets checked and display the message on log. Don't worry abt this, its fine to have warning then silent problem.
This might even happens if you have default installation with LVM file system. Just ignore it nothing happens with that warning. Sometimes we have to ignore little things to solve big problems. U got the point.
 
Old 11-15-2010, 01:01 PM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
change your /etc/security/limits.conf file

add the line:

username soft nofile 65536
username hard nofile 65536

you have to set both hard and soft limits for it to work. reboot.
ulimit -a to check
 
Old 11-29-2010, 10:15 AM   #9
CHarlow
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Just wanted to add that finding this thread has resolved my Hyperion install problem, which was that I could change ulimit -n to 4096 in root, but it wouldn't allow it in the install user (oracle):
[bash: ulimit: open files: cannot modify limit: Operation not permitted].
Adding these lines in /etc/security/limits.conf did exactly what I wanted (I think!):
* soft nofile 4096
* hard nofile 4096
Big thank you for this forum!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ulimit spivy66 Linux - General 6 01-11-2008 01:33 PM
What is ulimit and what it does? brazilian_user Linux - General 3 01-30-2007 01:39 PM
ulimit introuble Linux - Security 1 07-22-2006 03:33 AM
Ulimit -v Help !!!!!!!!!!!!!!!!!!!!!! raees Linux - Software 1 07-04-2004 10:01 AM
ulimit -n evilrico Linux - Distributions 0 03-14-2003 04:23 PM

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

All times are GMT -5. The time now is 03:06 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