読者です 読者をやめる 読者になる 読者になる

nekop's blog

OpenShift / JBoss / WildFly / Infinispanの中の人 http://twitter.com/nekop

mod_clusterのインストール

jboss

JBoss

diff -ru ./server/.default/deploy/jbossweb.sar/META-INF/jboss-beans.xml ./server/modcluster/deploy/jbossweb.sar/META-INF/jboss-beans.xml
--- ./server/.default/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2011-11-11 14:26:03.000000000 +0900
+++ ./server/modcluster/deploy/jbossweb.sar/META-INF/jboss-beans.xml	2012-01-30 15:08:51.604775708 +0900
@@ -14,6 +14,9 @@
       <!-- Transaction manager for unfinished transaction checking in the CachedConnectionValve -->      
       <depends>jboss:service=TransactionManager</depends>
 
+      <!-- mod_cluster -->
+      <depends>ModClusterService</depends>
+
       <!-- Inject the TomcatDeployer -->
       <property name="tomcatDeployer"><inject bean="WarDeployer"/></property>
       <!-- Set the securityManagerService used to flush the auth cache on session expiration -->
diff -ru ./server/.default/deploy/jbossweb.sar/server.xml ./server/modcluster/deploy/jbossweb.sar/server.xml
--- ./server/.default/deploy/jbossweb.sar/server.xml	2011-11-11 14:26:03.000000000 +0900
+++ ./server/modcluster/deploy/jbossweb.sar/server.xml	2012-01-30 15:09:36.710076533 +0900
@@ -6,6 +6,9 @@
    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
    <Listener className="org.apache.catalina.core.JasperListener" />
 
+   <!-- mod_cluster -->
+   <Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener" delegateBeanName="ModClusterService"/>
+
    <Service name="jboss.web">
 
       <!-- A HTTP/1.1 Connector on port 8080 -->
@@ -29,7 +32,7 @@
            keystorePass="rmi+ssl" sslProtocol = "TLS" />
       -->
 
-      <Engine name="jboss.web" defaultHost="localhost">
+      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
 
          <!-- The JAAS based authentication and authorization realm implementation
          that is compatible with the jboss 3.2.x realm implementation.

httpd

conf.d/mod_cluster.confをこんな感じで作成

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so
MemManagerFile /var/cache/mod_proxy/manager

Listen 127.0.0.1:6666
<VirtualHost 127.0.0.1:6666>
  <Directory />
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
  </Directory>
  KeepAliveTimeout 60
  MaxKeepAliveRequests 0
  ServerAdvertise On
  AdvertiseFrequency 5
</VirtualHost>

<Location /mod_cluster-manager>
  SetHandler mod_cluster-manager
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Location>

加えてconf/httpd.confのLoadModule proxy_balancer_module modules/mod_proxy_balancer.soをコメントアウト

mod_cluster 1.2.0以降ならEnableMCPMReceiveを管理VHostに追加。