/home/haqen

apache mod_jk ile jboss’a yönlendirme yapmak

by admin on Jan.17, 2009, under yazılım geliştirme

dedim ya, jboss cluster ile uğraşıyorum, baya bi uraştım ama henüz 2 sunucuyu birbirine göstertemedim :) hesapta “aynı networkte otomatik olarak birbirlerini görmeleri” gerekiyormuş ama beceremedim daha.

bu işler ile uğraşırken, apache mod_jk ayarı yapmayı öğrendim, apache’yi load balancer olarak kullanıp aynı zamanda statik içerikleri sunarken diğer istekleri başka bir uygulama sunucuya yönlendirmeyi sağlayan bu modülü hep merak ediyordum. meğersem ayarlaması çok basit imiş. nasılmış?

1) önce uygun mod_jk.so dosyasını apache’nin sitesinden indirip /etc/httpd/modules dizini altına atıyoruz

2) /etc/httpd/conf/httpd.conf dosyasının sonuna şu satırları ekliyoruz:
# Add this to the end of httpd.conf
LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>
Include conf/modjk.conf
</IfModule>

3) /etc/httpd/conf/modjk.conf dosyasını oluşturup içine:
JkLogFile logs/modjk.log
JkLogLevel info
JkWorkersFile conf/jkworkers.properties
JkMountFile conf/jkmount.properties

# JK Balancer manager
<Location /status/>
JkMount jkstatus
Order deny,allow
Allow from all
</Location>
4) /etc/httpd/conf/jkworkers.properties dosyasını oluşturup:
worker.list=jboss,jkstatus

# First Node
worker.node1.type=ajp13
worker.node1.host=node1.server
worker.node1.port=8009
worker.node1.lbfactor=1
worker.node1.disabled=false
worker.node1.socket_timeout=10
worker.node1.connect_timeout=20000

# Second Node
worker.node2.type=ajp13
worker.node2.host=node2.server
worker.node2.port=8009
worker.node2.lbfactor=1
worker.node2.disabled=false
worker.node2.socket_timeout=10
worker.node2.connect_timeout=20000

# Load balancer
worker.jboss.type=lb
worker.jboss.balance_workers=node1,node2
worker.jboss.sticky_session=true
worker.jboss.sticky_session_force=false
worker.jboss.method=R
worker.jboss.lock=P

worker.jkstatus.type=status

5) /etc/httpd/conf/jkmount.properties dosyasını oluşturup yönlendirmek istediğimiz pathleri yazıyoruz:
/hede/*=jboss
6) apache’yi restart ettikten sonra artık /hede/ yazdığımız zaman bu istek jboss’a yönlendiriliyor olacak. aynı zamanda jboss’lardan biri down olduğu zaman istek öbür jboss’a gidecek.

konunun detaylarına çok hakim değilim tabi. lazım olunca araştırıcam :D

No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!