Skip to content

JBoss Cluster ve Session Replication

JBoss Cluster ve Session Replication

Standart JBoss kurulumu yapıldıktan sonra cluster sunucular, JBOSS_HOME/server/all klasörünün kopyasından oluşacak. Örnek node1 ve node2. Sonra Yast ile Apache2 ve mod_jk paketlerini kuruyoruz. Kurulum sonrasında /etc/apache2/mod_jk klasörü oluşturulur. mod_jk klasörüne aşağıdaki dosyalar ve içerikleri oluşturulur.

mod_jk.conf Dosyası #Load mod_jk module # Specify the filename of the mod_jk lib # LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile /etc/apache2/mod_jk/workers.properties # Where to put jk logs JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the log format JkLogStampFormat “[%a %b %d %H:%M:%S %Y]” # JkOptions indicates to send SSK KEY SIZE JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat JkRequestLogFormat “%w %V %T” # Mount your applications JkMount /application/* loadbalancer # You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile /etc/apache2/mod_jk/uriworkermap.properties # Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly JkShmFile /etc/apache2/mod_jk/mod_jk.shm # Add jkstatus for managing runtime data <Location /jkstatus/> JkMount status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> workers.properties Dosya İçeriği # Define list of workers that will be used # for mapping requests worker.list=loadbalancer,status # Define Node1 # modify the host as your host IP or DNS name. worker.node1.port=8109 worker.node1.host=192.168.10.187 worker.node1.type=ajp13 worker.node1.lbfactor=1 worker.node1.cachesize=100 # Define Node2 # modify the host as your host IP or DNS name. worker.node2.port=8209 worker.node2.host=192.168.10.187 worker.node2.type=ajp13 worker.node2.lbfactor=1 worker.node2.cachesize=100 # Load-balancing behaviour worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=node1,node2 worker.loadbalancer.sticky_session=1 #worker.list=loadbalancer # Status worker for managing load balancer worker.status.type=status uriworkermap.properties Dosya İçeriği #Simple worker configuration file # Mount the Servlet context to the ajp13 worker /jmx-console=loadbalancer /jmx-console/*=loadbalancer /web-console=loadbalancer /web-console/*=loadbalancer /xxxxx=loadbalancer /xxxxx/*=loadbalancer etc/sysconfig/apache2 dosyası açılıp APACHE_MODULES=”.. .. .. jk” satırına eklenir. Sonrasında /var/log/apache2/mod_jk.log dosyası oluşturulur. /etc/sysconfig/rcapache2 start “ ile apache sunucusu çalıştırılır.   Jboss Tararafında Yapılacaklar JBOSS_HOME/server/node1/deploy/jbossweb.sar/server.xml dosyasında <Engine name=”jboss.web” defaultHost=”localhost”> satırı <Engine name=”jboss.web” defaultHost=”localhost” jvmRoute=”node1”> şekliyle değiştirilir. Node2 de aynı işlem yapılır. Yine server.xml dosyasında alt satır bütün node ve all kasörüyle aynı olduğu kontrol edilmelidir. <Connector protocol=”AJP/1.3″ port=”8009″ address=”${jboss.bind.address}” redirectPort=”8443″ /> xxxx.war içinde web.xml ve jboss-web.xml dosyaları replication için uyumlu olmalıdır. Web.xml örnek: <mime-mapping> <extension>txt</extension> <mime-type>text/plain</mime-type> </mime-mapping> <distributable/> </web-app> Jboss-web.xml dosyası : <jboss-web> <replication-config> <replication-trigger>SET</replication-trigger> <replication-granularity>ATTRIBUTE</replication-granularity> <replication-field-batch-mode>true</replication-field-batch-mode> <use-jk>false</use-jk> <max-unreplicated-interval>30</max-unreplicated-interval> <snapshot-mode>INSTANT</snapshot-mode> <snapshot-interval>2000</snapshot-interval> </replication-config> </jboss-web> 3 node Jboss için çalıştırılacak komutlar : ./run.sh -c all -b 192.168.10.187 & ./run.sh -c node1 -b 192.168.10.187 -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=1 & ./run.sh -c node2 -b 192.168.10.187 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=2 & ./run.sh -c node3 -b 192.168.10.187 -Djboss.service.binding.set=ports-03 -Djboss.messaging.ServerPeerID=3 & Portlar standart bıraktığımızda node1 : http://192.168.10.187/8180/admin-console node2 : http://192.168.10.187/8280/admin-console node3 : http://192.168.10.187/8380/admin-console
Published inWEB SERVERS

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *