修改普通用户的最大文件打开数

使用到mongo,redis等数据库的时候,往往会遇到这样一个坑。某mongo跑着跑着突然没了,某redis启动先给个warning,仔细一看log说最大文件打开数不够..

# You requested maxclients of 10000 requiring at least 10032 
# max file descriptors.
# Redis can't set maximum open files to 10032 because of OS error: 
# Operation not permitted.
# Current maximum open files is 1024. 
# maxclients has been reduced to 4064 
# to compensate for low ulimit. 
# If you need higher maxclients increase 'ulimit -n'.

(more…)