server-side/haproxy

HAProxy FD Limt maxconn/maxsock

C/H 2017. 6. 20. 08:30

restart error

[root@paranoid ~]# ssh haproxy1
Last login: Tue Jun 13 10:13:06 2017 from data-server.cs2aa3cloud.internal
[root@haproxy1 ~]# systemctl status haproxy
● haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
   Loaded: loaded (/etc/rc.d/init.d/haproxy; bad; vendor preset: disabled)
   Active: failed (Result: signal) since Tue 2017-06-13 03:29:01 KST; 10h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 22220 ExecStop=/etc/rc.d/init.d/haproxy stop (code=exited, status=0/SUCCESS)
  Process: 22207 ExecReload=/etc/rc.d/init.d/haproxy reload (code=exited, status=0/SUCCESS)
  Process: 1764 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=0/SUCCESS)
 Main PID: 22212 (code=killed, signal=KILL)

Jun 12 18:42:22 haproxy1.localdomain haproxy[1764]: [  OK  ]
Jun 12 18:42:22 haproxy1.localdomain systemd[1]: Started SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Jun 13 03:29:01 haproxy1.localdomain haproxy[22207]: [WARNING] 163/032901 (22211) : stats socket will not work as expected in multi-process mode (nbproc > 1), you should force process binding globally using 'stats bin...cess' attribute.
Jun 13 03:29:01 haproxy1.localdomain haproxy[22207]: [WARNING] 163/032901 (22211) : [/usr/sbin/haproxy.main()] Cannot raise FD limit to 1600074, limit is 4096.
Jun 13 03:29:01 haproxy1.localdomain haproxy[22207]: [WARNING] 163/032901 (22211) : [/usr/sbin/haproxy.main()] FD limit (4096) too low for maxconn=800000/maxsock=1600074. Please raise 'ulimit-n' to 1600074 or more to avoid any trouble.
Jun 13 03:29:01 haproxy1.localdomain systemd[1]: Reloaded SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Jun 13 03:29:01 haproxy1.localdomain systemd[1]: haproxy.service: main process exited, code=killed, status=9/KILL
Jun 13 03:29:01 haproxy1.localdomain haproxy[22220]: Shutting down haproxy: [FAILED]
Jun 13 03:29:01 haproxy1.localdomain systemd[1]: Unit haproxy.service entered failed state.
Jun 13 03:29:01 haproxy1.localdomain systemd[1]: haproxy.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

FD limit (4096) too low for maxconn=800000/maxsock=1600074. Please raise 'ulimit-n' to 1600074 or more to avoid any trouble.
maxconn = 800000 / maxsock = 1600074에 대해 FD 제한 (4096)이 너무 낮습니다. 문제가 발생하지 않도록 'ulimit-n'을 1600074 이상으로 올리십시오.

설정 변경

# 1. 현재 파일 오픈 제한값.
more /proc/sys/fs/file-max
1609863

sysctl -a | grep fs.file-max
fs.file-max = 1609863

# 2. 현재 사용중인 열린 파일 디스크립터 수.
more /proc/sys/fs/file-nr
1184	0	1609863

# 3. 열링 파일 수 확인. 1 개의 파일 디스크립터가 복수의 열린 파일을 첨부 할 수 있다.
lsof | wc -l
2359


# 4. fs.file-max 값 설정.
vi /etc/sysctl.conf
fs.file-max = 65535

# 5. 변경사항 적용
sysctl -p
fs.file-max = 65535
vi /etc/sysctl.conf
fs.file-max = 65535

sysctl -p

/sbin/sysctl -w net.core.somaxconn=65535
sysctl -p /etc/sysctl.conf
ulimit -n 65535
ulimit -u 65535

// 아래 파일 열어서 추가
vi /etc/security/limits.conf
root hard nofile 65535
root soft nofile 65535


반응형

'server-side > haproxy' 카테고리의 다른 글

HAProxy balance  (0) 2017.07.04
haproxy reload FAILED  (1) 2017.06.22
'option forwardfor' ignored for proxy  (0) 2017.06.19
HAProxy Gateway timeout  (0) 2017.06.15
HATop  (0) 2017.06.13