apache session stick上线部署

一、 apache  session stick上线部署
1、 开通172.16.50.72的8009网络端口,供172.16.21.181访问;(负责人李明新)
2、 设置apache session stick功能
⑴ Mas服务器端的配置
 打开部署mas应用的jetty服务器的jetty.xml文件,找到以下这段内容,默认情况下,该段内容是被注释掉的。
<!-- =========================================================== -->
    <!-- Set up global session ID manager                            -->
<!-- =========================================================== -->
    <!--
    <Set name="sessionIdManager">
      <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
        <Set name="workerName">node1</Set>
      </New>
    </Set>
    -->
 去掉注释符,修改workerName。
<!-- =========================================================== -->
<!-- Set up global session ID manager                            -->
<!-- =========================================================== -->
<Set name="sessionIdManager">
      <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
        <Set name="workerName">mas-72</Set>
      </New>
    </Set>
注:如果网络中多台机器配置session stick,workerName必须唯一。
 打开部署mas应用的jetty服务器的jetty-ajp.xml文件,把注释符去掉,去掉后的文件内容如下:
<Configure id="Server" class="org.mortbay.jetty.Server">

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add a AJP listener on port 8009      -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addConnector">
    <Arg>
       <New class="org.mortbay.jetty.ajp.Ajp13SocketConnector">
         <Set name="port">8009</Set>
       </New>
    </Arg>
  </Call>
</Configure>
注:这一块如果已打开,就不用管了!
⑵ Apache服务器端的配置
 打开apache服务器的httpd.conf配置文件,确认以下三个so 文件均已配置:
-- Using apache mod-proxy and an normal Jetty HTTP connector.
LoadModule proxy_module modules/mod_proxy.so
-- Using apache mod-proxy-ajp and the Jetty AJP connector.
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
-- load balance over HTTP and AJP connectors
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 在httpd.conf中添加以下Include:
Include conf/mas.conf
在httpd.conf同目录下,新增mas.conf文件,并添加以下内容:
Listen 8097
<VirtualHost _default_:8097>
DocumentRoot "/opt/oracle/apache2/htdocs"   #根据服务器作修改
ServerName localhost #根据服务器作修改
ServerAdmin [email protected]
ErrorLog "/opt/oracle/apache2/logs/error_log"  #根据服务器修改
TransferLog "/opt/oracle/apache2/logs/access_log"  #根据服务器修改
SSLEngine on
SSLCipherSuite ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
SSLCertificateFile "/root/ks/srv/99bill2010.crt"  #根据服务器作修改
SSLCertificateKeyFile "/root/ks/srv/99bill2010.key" #根据服务器作修改
SSLCertificateChainFile "/root/ks/srv/versignprimaryCA.cer" #根据服务器作修改
SSLCACertificateFile "/root/ks/trust/mas/mas_ca.crt" #根据服务器作修改
SSLVerifyClient require
SSLVerifyDepth  10
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire

# map to cluster with session affinity (sticky sessions)
ProxyPass /balancer !
ProxyPass / balancer://mas/ stickysession=JSESSIONID nofailover=On

<Proxy balancer://mas>
    BalancerMember ajp://172.16.70.72:8009 route=mas-72
</Proxy>

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/local/apache2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog "/opt/apache_log/ssl_request_log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

JkMount /* mas
</VirtualHost>
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{REQUEST_URI} ^/mas(.*)$
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}:443/mas/

说明:stickysession=JSESSIONID nofailover=On 用于session复制,如果不加,使用部分功能系统会退出。

你可能感兴趣的:(apache,session,jetty,stick)