Thursday, November 20, 2014

changing the value at /etc/security/limits.conf file

UNIX Support - Update a standard system configuration file
Please update /etc/security/limits.conf file on mysassrv05 to change nofile limit for mossas1 to 65000.

=====================================
To set the limit system wide for all user,
echo "* hard nofile 10240" >> /etc/security/limits.conf
echo "* soft nofile 10240" >> /etc/security/limits.conf
sysctl -w fs.file-max=10240
sysctl -p - Loads the value setting specified on /etc/sysctl or defined value.
There is no reboot required and it also works fine even after reboot. The value defined here is just a reference but you can define your own.

========================================

On Solaris:
add entry to /etc/system
set rlim_fd_max = 4096

# Hard limit on file descriptors for a single proc
##(Without this above condition, the default value for nofiles is half of the rlim_fd_cur)

set rlim_fd_cur = 1024 # Soft limit on file descriptors for a single proc
On AIX:
etc/security/limits
- you can configure ulimits for each user here
esaadmin:
 stack = 393216
 stack_hard = 393216

On Linux:
/etc/security/limits.conf
- you can configure ulimits for each user here

username hard nofile 4096
username soft nofile 63536
Hard and soft limits of 4096 for 'nofile' (all users)
* soft nofile 4096
* hard nofile 4096


Lock paged memory when using memcached by using memcached -k option

How to lock the paged memory?
# man memcached

#memcached -u user -k &
 warning: -k invalid, mlockall() failed: Cannot allocate memory

The reason is that by default locked memory is 64K.
Run the command below to see the output
# ulimit -l
64

You can change the value by addeding entry for memlock at /etc/security/limits.conf for root user.

# - memlock - max locked-in-memory address space (KB)
oracle soft nofile 24576
oracle hard nofile 65536
root   -     memlock   1048576
Verify the change, you may want to logout and log back in to test it.
# ulimit -l
If you are setting values for normal user
Once you made the change, su to the user and run the following command to see hard and soft limit.
Not: do man for more info or google is there for you.
$ ulimit -Hn
4096
$ ulimit -Sn
4096
$ id
uid=65128(mysas) gid=75260(sasgrp)
$
ulimit -u

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Please change nofile limit for mostmgr to 65000.
# more /etc/security/limits.conf

* hard core 0
* soft core 0
mostmgr         hard    nofile          25000
mostmgr         soft    nofile          25000
# End of file

# vi /etc/security/limits.conf
#@student        -       maxlogins       4
* hard core 0
* soft core 0
mostmgr         hard    nofile          65000
mostmgr         soft    nofile          65000
# End of file

# su - trnmgr
$ ulimit -Hn
4096
$ ulimit -Sn
4096
$ id
$ ulimit -u

To set the limit system wide for all user,
# echo "* hard nofile 10240" >> /etc/security/limits.conf
# echo "* soft nofile 10240" >> /etc/security/limits.conf
# sysctl -w fs.file-max=10240
# sysctl -p
========================================

On Solaris:
add entry to /etc/system
set rlim_fd_max = 4096 # Hard limit on file descriptors for a single proc
##(Without this above condition, the default value for nofiles is half of the rlim_fd_cur)
set rlim_fd_cur = 1024 # Soft limit on file descriptors for a single proc
On AIX:
etc/security/limits
- you can configure ulimits for each user here
esaadmin:
 stack = 393216
 stack_hard = 393216

On Linux:
/etc/security/limits.conf
- you can configure ulimits for each user here
username hard nofile 4096
username soft nofile 63536
Hard and soft limits of 4096 for 'nofile' (all users)
* soft nofile 4096
* hard nofile 4096

 

No comments:

Post a Comment