欢迎光临自己的路个人博客站!

自己的路个人网站-自己的路个人博客

自己的路个人博客网站

关注在二实小学习、生活、运动的个人博客

您当前的位置:主页 > 开源无价 >

Solaris下安装配置httpd server与tomcat负载均衡

发布时间:2015-09-06 07:50 点击: 编辑:admin

一。下载所需软件 q2hFOm  
         apache-tomcat-6.0.18.tar.gz $&{ti.l  
         mod_jk-1.2.27-httpd-2.2.6.so hfqqQ!,l!  
         httpd-2.2.6.tar.gz `:e U.  
         jdk-1_5_0_16-solaris-sparc.sh $= B8qZ+  
         jdk-1_5_0_16-solaris-sparcv9.sh K{@3\5<  
:w`3cw Q  
二。自解压安装java环境 )[L^Dmd,  
        运行jdk-1_5_0_16-solaris-sparc.sh和jdk-1_5_0_16-solaris-sparcv9.sh %dMqpY7"  
DZ$` 4;C[  
三。解压apache-tomcat-6.0.18.tar.gz,复制两个tomcat实例(同一台主机),比如apache-tomcat-6.0.18-1和apache-tomcat-6.0.18-2,把tomcat实例2的服务端口修改成与tomcat实例1不冲突的端口值 \(~wZd  
        <Server port="8006" shutdown="SHUTDOWN"> a,|?5j9,P  
        <Connector port="8081" protocol="HTTP/1.1" =-KMb`xT  
               connectionTimeout="20000" {D` '0Z1"  
               redirectPort="8444" /> !345 %,  
        <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" /> iD`d99f8O  
>&,[H: Z  
四。安装配置httpd 31WC=ur5  
        解压httpd-2.2.6.tar.gz,然后配置编译安装 j}1zdA  
        ./configure --prefix=/usr/local/httpd2.2.6 --enable-so --enable-mods-shared=most 7ZxaPkIu&%  
        make "9!d]2.-Vk  
        make install 7O5`v(<9n>  
        把mod_jk-1.2.27-httpd-2.2.6.so复制到modules目录下,修改conf/httpd.conf文件 mLh kI!4[  
        LoadModule    jk_module  modules/mod_jk-1.2.27-httpd-2.2.6.so .Jx9 bIw  
        JkWorkersFile /usr/local/httpd2.2.6/conf/workers.properties ^y!;xc$(Qs  
        JkShmFile        /usr/local/httpd2.2.6/conf/mod_jk.shm `x8J  
        JkLogFile        /usr/local/httpd2.2.6/conf/mod_jk.log ({r*=wAP  
        JkLogLevel    info ?BA]7M(,4  
        JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " mw$r$C{  
        JkMount  /*.jsp router Zxr!:t7  
        JkMount  /*/servlet/* router %nN `|\  
S$)*&46g  
        workers.properties内容如下 `Z: R Ce^  
        worker.list=router 5=Xy,hmnC  
        worker.router.type=lb m!<i0thJ  
        worker.router.balance_workers=worker1,worker2 j /=i Mq  
        worker.router.sticky_session=true A?_=K  
NBl+_/2'w  
        worker.worker1.type=ajp13 *eI)Z=8  
        worker.worker1.host=localhost &'cL%.  
        worker.worker1.port=8009 V7#v6!7A@  
        worker.worker1.lbfactor=1 |*Z$E$k:  
         SJD@&m%?[  
        worker.worker2.port=8010 f# +el y  
        worker.worker2.host=localhost F, U*yj  
        worker.worker2.type=ajp13 %ZHP2j %~  
        worker.worker2.lbfactor=1 %X#zj"  
fXrXV~'8  
五。另外可以把两个tomcat组成一个cluster,实现会话复制共享 t78k4?  
        tomcat实例1 U qG .:@T  
            <Engine name="Catalina" defaultHost="localhost" jvmRoute="work1"> z-M3  
Uj&W<'I  
                Cluster节点内容 KNH1#30 K  
                  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"> LC1 (Xb f  
                   <Manager className="org.apache.catalina.ha.session.DeltaManager" lu Q~YjH  
                   expireSessionsOnShutdown="false" [+qCs7'  
                   notifyListenersOnReplication="true"/> apE   
          <Channel className="org.apache.catalina.tribes.group.GroupChannel"> o|jIM9/  
            <Membership className="org.apache.catalina.tribes.membership.McastService" <&)v~-&O  
                        address="228.0.0.4" 1S@vGq}  
                        port="45564" 5dZ|!  
                        frequency="500" ca+[0w@S  
                        dropTime="3000"/> OyqNLR  
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" Ivb 4P`{  
                      address="auto" )V!dBl"Gq  
                      port="4000" ~a xjjv  
                      autoBind="100" k}~O}~-  
                      selectorTimeout="5000" np~~mdmRK  
                      maxThreads="6"/> &w=3 ^  
            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> $8a(veXd  
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> s: 3z'4oX  
            </Sender> NKQOUw:qn  
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> LdB($4,  
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> u : F~K  
          </Channel> [ d* ~@P  
          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" cW+t#>' r  
                 filter=""/> NH0qVQ@A  
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/> q{ O% |  
          <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" IJ/sX_k  
                    tempDir="/tmp/war-temp/" {aM<{_v  
                    deployDir="/tmp/war-deploy/" UQ4% Xp  
                    watchDir="/tmp/war-listen/" 9aJ%`i  
                    watchEnabled="false"/> oHs2L-G  
          <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/> = w$}m_AM  
          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> U"50_O  
     </Cluster>  &hk-1y9QS  
is/scv<  
        tomcat实例2 2./ 3 \n2  
        <Engine name="Catalina" defaultHost="localhost" jvmRoute="work2"> rLX4jT^  
E#F/88(  
                Cluster节点内容 {?`al5Sz  
                  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"> ;m2<eS`o'  
                   <Manager className="org.apache.catalina.ha.session.DeltaManager" n!qV>k9Y  
                   expireSessionsOnShutdown="false" :g.46dp4  
                   notifyListenersOnReplication="true"/> _FwK-?4E-  
          <Channel className="org.apache.catalina.tribes.group.GroupChannel"> D0N9Ksq  
            <Membership className="org.apache.catalina.tribes.membership.McastService" h`MF#617  
                        address="228.0.0.4" -Qn=|2Mm?  
                        port="45564" O=9-Qv|  
                        frequency="500" "5A&_E }3  
                        dropTime="3000"/> wK}\_2?  
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" CwJDmz\tk  
                      address="auto" aC< KN:TN6  
                      port="4001" z(\4 M==2O  
                      autoBind="100" DvM5 k  
                      selectorTimeout="5000" [2|kl l  
                      maxThreads="6"/> iH.$f /)N  
            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> -)~SM&  
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> jg&E94}+  
            </Sender> rcGb[=Bf  
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> N D<HXO  
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> P4Th_B7  
          </Channel> A*|cdY]HP  
          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" U?!>Nd  
                 filter=""/> 4tx|=;@0  
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/> '<0J@^vZ  
          <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" TT9z_Q5~  
                    tempDir="/tmp/war-temp/" -rKO )}  
                    deployDir="/tmp/war-deploy/" Pf F=m'  
                    watchDir="/tmp/war-listen/" ~8m=1)A{(  
                    watchEnabled="false"/> cVwbg[W]  
          <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/> Va$Pi19 O  
          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> Z#.f&K )xX  
     </Cluster>   |7KeR-  
         ?b!F a  
        然后在需要会话复制共享的应用的web.xml里加入<distributable/>,表示 Tomcat 要为此 Web 应用复制 Session .ZMW>U> 

最近访客

    热评文章

      Powered by FREEBSD NGINX PHP MYSQL FREEBSD NGINX PHP MYSQL