阅读:7421回复:0
Apache2.4+JBoss4.2.2之Session共享配置
说明:本次记录的是CentOS的,Windows的配置其实是一样的
-------------------------------------------------------------------------------------------- 1.准备Apache2.2和jboss4.2.2 centos安装Apache可用命令: yum -y install httpd 2.编辑/etc/httpd/conf/httpd.conf文件 1)确认监听的端口和地址: Listen 80 2)在上句话之后增加 #ADD BY HEARKEN ProxyRequests off ProxyPass "/" "balancer://proxy/" nofailover=On ProxyPassReverse "/" "balancer://proxy/" <Proxy "balancer://proxy"> BalancerMember ajp://10.158.90.53:8009 loadfactor=1 route=node1 BalancerMember ajp://10.158.90.54:8009 loadfactor=1 route=node2 </Proxy> #ADD BY HEARKEN #注意:8009后面不要加斜杠,加了平台会报找不到js的错 如下图所示: 图片:QQ截图20171226215101.jpg 3.配置Jboss4.2.2 1)将工程部署的目录放到JBOSS_HOME/server/all/deploy/ 下,并命名为“ROOT.war” 2)更改JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml (原则上改下面的蓝色字体的部分就行了) <Connector port="8080" address="0.0.0.0" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> <!--其中port就是访问应用的端口,可根据实际需要修改;address如果默认的话是只能本机访问到应用的,改成0.0.0.0即所有ip都可以访问到--> <Connector port="8009" address="0.0.0.0" protocol="AJP/1.3" emptySessionPath="true" enableLookups="false" redirectPort="8443" minProcessors="100" maxProcessors="500" acceptCount="100" connectionTimeout="120000" /> <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1"> <!-- jvmRoute是本节点在集群中的名称(同理另外一台服务器中就应该是node2)名字可以随便写,但是需要保证集群中所有节点都有唯一的名称--> 3)更改JBOSS_HOME/server/all/deploy/jboss-web-cluster.sar/META-INF/jboss-service.xml 找到<config><udp>将<config>到</config>全部注释掉 下面只改蓝色的字就可以了: <config> <TCP bind_addr="10.158.90.53" start_port="7810" loopback="true" tcp_nodelay="true" recv_buf_size="20000000" send_buf_size="640000" discard_incompatible_packets="true" enable_bundling="false" max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" use_outgoing_packet_handler="false" down_thread="true" up_thread="true" use_send_queues="false" sock_conn_timeout="300" skip_suspected_members="true"/> <TCPPING initial_hosts="10.158.90.53[7810],10.158.90.54[7810]" port_range="3" timeout="3000" down_thread="true" up_thread="true" num_initial_members="3"/> <MERGE2 max_interval="100000" down_thread="true" up_thread="true" min_interval="20000"/> <FD_SOCK down_thread="true" up_thread="true"/> <FD timeout="10000" max_tries="5" down_thread="true" up_thread="true" shun="true"/> <VERIFY_SUSPECT timeout="1500" down_thread="true" up_thread="true"/> <pbcast.NAKACK max_xmit_size="60000" use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800" down_thread="true" up_thread="true" discard_delivered_msgs="true"/> <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" down_thread="true" up_thread="true" max_bytes="400000"/> <pbcast.GMS print_local_addr="true" join_timeout="3000" down_thread="true" up_thread="true" join_retry_timeout="2000" shun="true" view_bundling="true"/> <FC max_credits="2000000" down_thread="true" up_thread="true" min_threshold="0.10"/> <FRAG2 frag_size="60000" down_thread="true" up_thread="true"/> <pbcast.STATE_TRANSFER down_thread="true" up_thread="true" use_flush="false"/> </config> 4)修改应用目录的WEB-INF/web.xml 在web.xml的<web-app></web-app>之间添加<distributable/> ,表示在分布式Web容器中部署 在WEB-INF目录下新建jboss-web.xml,内容如下: <jboss-web> <context-root>/</context-root> <replication-config> <replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger> <replication-granularity>SESSION</replication-granularity> <replication-field-batch-mode>true</replication-field-batch-mode> </replication-config> </jboss-web> 5)修改应用目录的WEB-INF/web.xml JBOSS_HOME \server\all\deploy\jboss-web.deployer\conf里的web.xml里的下面内容进行注释(解决与核格平台内部的包冲突) <listener> <listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class> </listener> <listener> <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class> </listener> 6)启动(更改目录) 将/home/jboss-4.2.2.GA/server/目录下的all目录改成default(原default目录可以先改成其他名字) (或者启动Jboss的时候加上"-c all"的参数就不用改目录名了) |
|