Computer ???
No. | 483 |
Name. | swindler |
Subject. | HAProxy systemd 등록하기 (작업중) |
Main Cate. | Linux |
Sub Cate. | |
Date. | 2017-12-20 12:00 |
Hit. | 2582 (125.131.199.20) |
File. | |
systemd 등록 /usr/lib/systemd/system/haproxy.service ---------------------- [Unit] Description=HAProxy Load Balancer After=syslog.target network.target [Service] ExecStart=/usr/local/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid ExecReload=/bin/kill -USR2 $MAINPID [Install] WantedBy=multi-user.target ---------------------- 서비스 시작 및 등록 systemctl start haproxy systemctl enable haproxy 이렇게 하면 정상적으로 start가 되지 않는다. polkitd 에서 unregistered 어쩌고 하면서 오류가 난다. 혹자는 mkdir -p /run/haproxy 로 socket을 위한 폴더를 만들라고 하는데, 해 봤다. 여전히 안 된다. /etc/systemd/system/haproxy 를 다음과 같이 작성하는 사람도 있다. ----------------------------- [Service] ExecStart=/usr/sbin/haproxy Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=haproxy User=root Group=root Environment=NODE_ENV=production [Install] WantedBy=multi-user.target ----------------------------- 그리고 systemctl enable haproxy systemctl enable 명령어는 부팅후 서비스 활성화를 할 것인지 설정한다. systemctl disable mkdir -p /etc/haproxy/errors (-p 옵션은 상위디렉토리까지 한꺼번에 생성하는 옵션임) cp examples/ssl.cfg /etc/haproxy/haproxy.cfg 계정추가 useradd haproxy /etc/haproxy/haproxy.cfg 파일 ---------------------- global log 127.0.0.1 local0 maxconn 4096 daemon uid 99 gid 99 defaults log global mode http option httplog option dontlognull timeout server 5s timeout connect 5s timeout client 5s stats enable stats refresh 10s stats uri /haproxy_stats frontend http-in bind *:80 reqadd X-Forwarded-Proto:\ http default_backend http_backend backend http_backend mode http balance roundrobin cookie SERVERID insert indirect nocache server s1 naver.com:80 check cookie s1 server s2 google.com:80 check cookie s2 ---------------------- 시작 및 상태점검 /etc/rc.d/init.d/haproxy restart haproxy 서버의 IP주소와 위에서 설정한 stats uri 값을 참고하여 아래와 같이 브라우저로 접속가능하다. http://1.1.1.1/haproxy_stats ============================================ 그리고 서비스 등록을 위해서 다음과 같이 한다. cp examples/haproxy.init /etc/rc.d/init.d/haproxy cd /etc/rc.d/init.d chmod 755 haproxy service haproxy Usage: haproxy {start|stop|restart|reload|condrestart|status|check} cp haproxy /usr/sbin (컴파일하면 haproxy 파일이 생성된다.) 시작은 service haproxy start 로 한다. [바로가기 링크] : http://coolx.net/cboard/computer/483 |
|
|
|
[Modify] [Delete] | [Reply] [List] |