webserver : apache2
was : tomcat8
내가 원하는 서버 구성은 아래 그림과 같다.
apache 에서 mod_proxy 설정으로 tomcat server 2개로 연결해서 사용하고 있는데 was1이 active고
was1이 서비스 중단 되었을때 바로 was2로 연결해서 무중단(?) 서비스를 설정하려고 한다.
- apache module 확인
 
      # httpd -M | grep proxy
      proxy_module (shared)
      proxy_ajp_module (shared)
      proxy_balancer_module (shared)
      proxy_connect_module (shared)
      proxy_express_module (shared)
      proxy_fcgi_module (shared)
      proxy_fdpass_module (shared)
      proxy_ftp_module (shared)
      proxy_http_module (shared)
      proxy_scgi_module (shared)
      proxy_wstunnel_module (shared)
- tomcat8/conf/server.xml
 
      context에 sessionCookieName="test_JSESSIONID" 추가
- conf.d/vhost.conf
 
     VirtualHost *:80
       ServerName test.com
       ProxyRequests Off
             Order deny,allow
             Allow from all
             # Balancer member 1
             BalancerMember http://localhost:8080 loadfactor=1 retry=2
             # Balancer member 2
             BalancerMember http://localhost:9090 status=+H retry=0
       ProxyPass / balancer://mycluster/ stickysession=test_JSESSIONID|jsessionid
       ProxyPassReverse /4  http://localhost::8080/
       ProxyPassReverse /4  http://localhost::9090/
       ProxyPreserveHost On
       ProxyStatus On
     VirtualHost
     # systemctl restart httpd
- 에러 분석
 
      error_log에 proxy:error Permission denied 에러 발생
      # 분석
      # audit2why < /var/log/audit/audit.log
      # semanage port -l |grep http_port_t
      http_port_t                    tcp      28009, 18009, 80, 81, 443, 488, 8008, 8009, 8443, 9000
      pegasus_http_port_t            tcp      5988
- 처리
 
      semanage 에 해당 포트가 없으면 등록을 해줘야 한다.
      # semanage port -a -p tcp -t http_port_t  8080
      # semanage port -a -p tcp -t http_port_t  9090
      이미 등록 되어있다는 에러가 나오면
      # semanage port -m -p tcp -t http_port_t  8080
      # semanage port -m -p tcp -t http_port_t  9090
- 테스트
 
      was1 shutdown  후 test.com 접속 후 was2 접속 로그 확인
      was1 startup 후 test.com 접속 후 was1 접속 로그 확인
- 참고
 
댓글 없음:
댓글 쓰기