3

I am using ubunto 18.04, When i run redis-server on the terminal it says

# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
# Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=11260, just started
# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
# You requested maxclients of 10000 requiring at least 10032 max file descriptors.
# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
# Current maximum open files is 1022. maxclients has been reduced to 990 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
# Creating Server TCP listening socket *:6379: bind: Address already in use

I tried to increase this limit before by running

ulimit -n 10240

But it resulted in following error

bash: ulimit: open files: cannot modify limit: Operation not permitted

Then I tried to lower its value by running ulimit -n 1022 and it surprisingly ran successfully and decreased that limit.

I then followed this answer, but after doing echo 800000 > /proc/sys/fs/file-max overrides the "file-max" file but do not actually change max file limit

$ ulimit -n 
1022

Here I found another related question and my case seem to be System C one. I tried doing the following.

1) I added the following lines in my /etc/security/limits.conf file.

* soft nofile 4096
* hard nofile 10240

2) Added the following line in /etc/ssh/sshd_config file

UsePAM=yes

3) Added the follwing in '/etc/pam.d/sshd' file

session    required   pam_limits.so

But still no effect. ulimit -n command still shows 1022.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
M. Habib
  • 131
  • 1
  • 4
  • [This question](https://unix.stackexchange.com/questions/36841/why-is-number-of-open-files-limited-in-linux?noredirect=1&lq=1) also seems informative but is of no use. I am unable to update my per process file limit. – M. Habib May 28 '18 at 03:18
  • (1) Have you read documentation on `ulimit`?  Like the part about not being able to increase the hard limit, or raise the soft limit above the hard limit, unless you’re root?  You show a `ulimit` command with a `$` prompt.  Are you running as root? (2) Did you reboot after editing the `/etc` files? (3) Did you try raising your limit (by typing `ulimit -n` followed by a number) after you edited the `limits.conf` file? … … … … … … … … … … … … … … … … … … … … … … … … … Please do not respond in comments; [edit] your question to make it clearer and more complete. – G-Man Says 'Reinstate Monica' May 28 '18 at 03:33

0 Answers0