使用 ulimit -ni 可以设置基于每个 shell 的最大打开文件限制
为了使这个值持久化,我可以在 /etc/security/limits.conf 中编辑它并重新启动 ubuntu 12.10 框,这是配置
* soft nofile 10240
* hard nofile 10240
root soft nofile 10240
root hard nofile 10240
Run Code Online (Sandbox Code Playgroud)
但上述值并未应用于 memcached 服务,如何将“最大打开文件数 10240”设置为 memcached 服务。
即使在设置limits.conf之后,memcached仍然显示
xx@xx:~$ ps aux|grep mem
mysql 2044 0.0 0.0 327436 1260 ? Sl 17:09 0:00 /usr/bin/memcached -vv -m 256 -p 11211 -u mysql -l 0.0.0.0
xx@xx:~$ cat /proc/2044/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes …Run Code Online (Sandbox Code Playgroud)