Author Topic: Redis can't set maximum open files to 10032 because of OS error: Operation not p  (Read 5517 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Redis can't set maximum open files to 10032 because of OS error: Operation not p
« on: พฤศจิกายน 17, 2017, 07:37:46 PM »
วันนี้เจอเคสว่า redis server รันๆอยู่แล้วโหลดสูงขึ้น ผิดปกติครับ

# 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'.
                _._                                                 
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 2.8.17 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 8945
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |           http://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                 
 |    `-._`-._        _.-'_.-'    |                                 
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               


Solution:

edit /lib/systemd/system/redis-server.service and add to the [Service] section the line (after: User=redis and Group=redis) LimitNOFILE=65536

run: systemctl daemon-reload && systemctl restart redis-server

Thanks to http://serverfault.com/questions/770037/debian-8-4-jessie-set-open-files-limit-for-redis-user/