Centos
HAProxy 無法啟動 SYSV
我正在嘗試啟動 ha 代理但沒有成功。這是來自 journalctl -xe 的錯誤:
Oct 18 23:11:27 upload-server polkitd[578]: Registered Authentication Agent for unix-process:2044:11115 (system bus name :1.14 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) Oct 18 23:11:27 upload-server systemd[1]: Starting SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.... -- Subject: Unit haproxy.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit haproxy.service has begun starting up. Oct 18 23:11:27 upload-server haproxy[2049]: /etc/rc.d/init.d/haproxy: line 26: [: =: unary operator expected Oct 18 23:11:27 upload-server haproxy[2053]: Proxy swift-cluster started. Oct 18 23:11:27 upload-server haproxy[2053]: Proxy swift-cluster started. Oct 18 23:11:27 upload-server haproxy[2049]: Starting haproxy: [ALERT] 291/231127 (2053) : Starting frontend GLOBAL: cannot bind UNIX socket [/run/haproxy/admin.sock] Oct 18 23:11:27 upload-server haproxy[2049]: [FAILED] Oct 18 23:11:27 upload-server systemd[1]: haproxy.service: control process exited, code=exited status=1 Oct 18 23:11:27 upload-server systemd[1]: Failed to start SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.. -- Subject: Unit haproxy.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit haproxy.service has failed. -- -- The result is failed. Oct 18 23:11:27 upload-server systemd[1]: Unit haproxy.service entered failed state. Oct 18 23:11:27 upload-server systemd[1]: haproxy.service failed. Oct 18 23:11:28 upload-server polkitd[578]: Unregistered Authentication Agent for unix-process:2044:11115 (system bus name :1.14, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
這是我的 /etc/haproxy/haproxy.cfg
global maxconn 4096 log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin stats timeout 30s user haproxy group haproxy daemon defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 timeout connect 5000 timeout client 50000 timeout server 50000 listen swift-cluster bind 192.168.0.91:80 mode http stats enable stats auth haproxy_username:haproxy_password balance roundrobin option httpchk HEAD /healthcheck HTTP/1.0 option forwardfor option http-server-close timeout http-keep-alive 500 server proxy1 192.168.0.41:80 weight 5 check inter 2000 server proxy2 192.168.0.42:80 weight 5 check inter 2000
我究竟做錯了什麼?
這是因為我忘記為套接字創建一個文件夾。這幫助了我:
sudo mkdir -p /run/haproxy