"Ubuntu ulimit ихэсгэх"-ны өөр хувилбарууд
Дусал нэвтэрхий толь-с
(Хуудас үүсгэв: "Set Permanently ulimit -n / open files in ubuntu Few days ago, my golang app in development server halted, then i check app’s log. 2018/03/26 10:06:56.373 [serve...") |
|||
4-р мөр: | 4-р мөр: | ||
Few days ago, my golang app in development server halted, then i check app’s log. | Few days ago, my golang app in development server halted, then i check app’s log. | ||
+ | <pre> | ||
2018/03/26 10:06:56.373 [server.go:2921] [HTTP] http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s | 2018/03/26 10:06:56.373 [server.go:2921] [HTTP] http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s | ||
+ | </pre> | ||
so, i check ulimit in my server, got open files configuration is default, 1024. Then i try set to 65535 which is that configuration is standart configuration in production server to avoid that error. Just typing as following : | so, i check ulimit in my server, got open files configuration is default, 1024. Then i try set to 65535 which is that configuration is standart configuration in production server to avoid that error. Just typing as following : | ||
+ | <pre> | ||
# set limit | # set limit | ||
user@ubuntu:~$ ulimit -n 65535 | user@ubuntu:~$ ulimit -n 65535 | ||
+ | </pre> | ||
When i relogin, i check again open files configuration, got 1024 or back to default. So, i want to set that new configuration (65535) permanently in my server. You can do it with following steps below : | When i relogin, i check again open files configuration, got 1024 or back to default. So, i want to set that new configuration (65535) permanently in my server. You can do it with following steps below : | ||
+ | <pre> | ||
# available limit | # available limit | ||
user@ubuntu:~$ ulimit -n | user@ubuntu:~$ ulimit -n | ||
25-р мөр: | 30-р мөр: | ||
# run this to refresh with new config | # run this to refresh with new config | ||
user@ubuntu:~$ sudo sysctl -p | user@ubuntu:~$ sudo sysctl -p | ||
+ | </pre> | ||
if you got error “sysctl: permission denied on key ‘fs.file-max’”, you can skip that step, then you doing steps as below : | if you got error “sysctl: permission denied on key ‘fs.file-max’”, you can skip that step, then you doing steps as below : | ||
+ | <pre> | ||
# edit the following file | # edit the following file | ||
user@ubuntu:~$ sudo vim /etc/security/limits.conf | user@ubuntu:~$ sudo vim /etc/security/limits.conf | ||
50-р мөр: | 57-р мөр: | ||
user@ubuntu:~$ ulimit -n | user@ubuntu:~$ ulimit -n | ||
65535 | 65535 | ||
+ | </pre> | ||
− | [https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a] | + | Source: [https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a] |
[[Ангилал:Сисадмин]] | [[Ангилал:Сисадмин]] |
03:15, 17 Арванхоёрдугаар сар 2020-ий байдлаарх одоогийн засвар
Set Permanently ulimit -n / open files in ubuntu
Few days ago, my golang app in development server halted, then i check app’s log.
2018/03/26 10:06:56.373 [server.go:2921] [HTTP] http: Accept error: accept tcp [::]:80: accept4: too many open files; retrying in 1s
so, i check ulimit in my server, got open files configuration is default, 1024. Then i try set to 65535 which is that configuration is standart configuration in production server to avoid that error. Just typing as following :
# set limit user@ubuntu:~$ ulimit -n 65535
When i relogin, i check again open files configuration, got 1024 or back to default. So, i want to set that new configuration (65535) permanently in my server. You can do it with following steps below :
# available limit user@ubuntu:~$ ulimit -n 1024 # To increase the available limit to say 65535 user@ubuntu:~$ sudo vim /etc/sysctl.conf # add the following line to it fs.file-max = 65535 # run this to refresh with new config user@ubuntu:~$ sudo sysctl -p
if you got error “sysctl: permission denied on key ‘fs.file-max’”, you can skip that step, then you doing steps as below :
# edit the following file user@ubuntu:~$ sudo vim /etc/security/limits.conf # add following lines to it * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard nofile 65535 root soft nproc 65535 root hard nproc 65535 root soft nofile 65535 root hard nofile 65535 # edit the following file user@ubuntu:~$ sudo vim /etc/pam.d/common-session # add this line to it session required pam_limits.so # logout and login and try the following command user@ubuntu:~$ ulimit -n 65535
Source: [1]