LINUX

File Descriptor 확인 및 설정

슬픈달 2020. 5. 25. 14:35
반응형

현재 실행 중인 프로세스의 File Descriptor 개수 확인


ls /proc/프로세스ID(PID)/fd/ | wc -l 



1. 현재의 Open 가능한 Maximum 파일 개수 확인


cat /proc/sys/fs/file-max 


-> 일반유저가 1개의 세션에서 열 수 있는 파일 개수


File Descriptor 는 hard, soft 값으로 나뉜다.



2. 전체 시스템에 적용되는 FD limit 값


시스템을 통해 Open 가능한 File Descriptor 개수는 /etc/sysctl.conf 파일로 변경 가능.


# sysctl -w fs.file-max=655360 


혹은


# vi /etc/sysctl.conf

  fs.file-max = 655360

# sysctl -p

# sysctl fs.file-max



3. 유저 레벨 FD limit 값


httpd 유저의 soft/hard limits 을 지정


# vi /etc/security/limits.conf

  httpd soft nofile 4096

  httpd hard nofile 10240 


반응형