Article

Setting Basic JBoss EAP 6 Cluster Menggunakan mod_jk untuk Load Balancing dan Failover

3 min Read

Red Hat JBoss Enterprise Application Platform (JBoss EAP) menghadirkan keamanan, kinerja, dan skalabilitas tingkat perusahaan di lingkungan apa pun. JBoss EAP dapat membantu Anda mengirimkan aplikasi lebih cepat, di mana saja. 

Persiapan Node Load Balancing

Kita akan membuat 2 node Jboss dan 1 node EWS sebagai load balancer cluster dengan session replication enabled, berikut alamat tiap node :

Node 1:  10.7.60.51

Node 2 :  10.7.60.52

EWS:  10.7.60.53

Contoh pada Node 1:

Set host name jboss ews

edit /etc/hosts/

install jdk for Linux:

rpm -ivh namafiles.rpm

  1. install jboss-eap-6.4.0.zip to a directory, contoh /opt/

cd /opt/

unzip jboss-eap-6.4.0.zip

      2. Menambahkan user yang akan menggunakan jboss EAP

Agar dapat menambahkan user pada Jboss EAP, kita harus melakukan edit file jmx-console-users.properties, tetapi pada Jboss 6 terdapat shell script di $JBOSS_HOME/bin directory yang bernama add-user.sh

Accept the default user type – Management User.

Accept the default realm – ManagementRealm

     3. Masukkan username dan password dari user yang akan dibuat, contoh admin/admin123. Kemudian kita akan ditanya mengenai beberapa pertanyaan, yang pertama pilih yes dan yang kedua pilih no

     4. Cluster Setup (coba standalone configuration)

Pada /opt/jboss-eap-6.4.0/standalone/configuration/standalone.xml, tambahkan ip of the node 1 yang akan di cluster.

<interfaces>

<interface name=”management”>

<inet-address value=”${jboss.bind.address.management:10.7.60.51}”/>

</interface>

<interface name=”public”>

<inet-address value=”${jboss.bind.address:10.7.60.51}”/>

</interface>

<interface name=”unsecure”>

<inet-address value=”${jboss.bind.address.unsecure:10.7.60.51}”/>

</interface>

</interfaces>

     5. Starting the servers

/opt/jboss-eap-6.4.0/bin/

./standalone.sh (ctrl+c)

     6. Edit standalone-ha.xml configuration

dan tambahkan ip of the node 1 in interface:

     7. Start standalone-ha configuration

./standalone.sh –Djboss.node.name=jboss-node1 -server-config=standalone-ha.xml -b 10.7.60.51

Konfigurasi Load Balancer Jboss EWS 

Langkah selanjutnya adalah konfigurasi pada mesin load balancer (jboss ews)

IP EWS:  10.7.60.53

  1. Set hostname
  2. set /etc/hosts
  3. install elinks, krb5-workstation, mailcap, mod_auth_kerb, and httpd
  4. cd /opt/ jboss-eap-6.4.0/httpd

Jalankan postinstall yang ada pada httpd

     5. ./.postinstall

     6. cd /sbin/

Start apache webserver

      7. ./apachectl start

      8. ada beberapa error ketika menjalankan apachectl, jadi kita harus analyze httpd log file nya

      9. tail /opt/jboss-eap-6.4.0/httpd/logs/httpd.log

Karena file auth_kerb.conf itu telah terhubung ke file lain, maka kita harus unlink terlebih dahulu

      10. ls -l /opt/jboss-eap-6.4.0/httpd/conf.d/auth_kerb.conf

      11. unlink /opt/jboss-eap-6.4.0/httpd/conf.d/auth_kerb.conf

      12. ./apachectl restart

      13. ./apachectl stop

      14. ./apachectl start

Copy modules tambahan agar dapat memberikan fitur load balancing, dan clustering.

 

modules yang diperlukan adalah

 

mod_advertise.so,

mod_jk.so,

mod_manager.so,

mod_proxy_cluster.so,

mod_slotmem.so

 

Copy semua modul tersebut ke dalam opt/jboss-eap-6.4.0/httpd/modules/, kemudian tambahkan konfigurasi berikut kedalam httpd.conf :

## Using mod_jk, mod_cluster in EWS 1.0.2

# mod_jk

#LoadModule jk_module /opt/jboss-ews-2.1/httpd/modules/mod_jk.so

#

# mod_cluster

# mod_proxy_balancer should be disabled when mod_cluster is used

#LoadModule proxy_cluster_module /opt/jboss-ews-2.1/httpd/modules/mod_proxy_cluster.so

#LoadModule slotmem_module /opt/jboss-ews-2.1/httpd/modules/mod_slotmem.so

#LoadModule manager_module /opt/jboss-ews-2.1/httpd/modules/mod_manager.so

#LoadModule advertise_module /opt/jboss-ews-2.1/httpd/modules/mod_advertise.so

# mod_proxy_balancer should be disabled when mod_cluster is used

LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

LoadModule slotmem_module modules/mod_slotmem.so

LoadModule manager_module modules/mod_manager.so

LoadModule advertise_module modules/mod_advertise.so

# Load mod_jk module

# Specify the filename of the mod_jk lib

LoadModule jk_module modules/mod_jk.so

JkWorkersFile /opt/jboss-ews-2.1/httpd/conf/workers.properties

JkLogFile logs/mod_jk.log

JkLogLevel info

JkLogStampFormat “[%a %b %d %H:%M:%S %Y]”

JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories

JkRequestLogFormat “%w %V %T”

JkMount /clusterdemo/* loadbalancer

JkMountFile /opt/jboss-ews-2.1/httpd/conf/uriworkermap.properties

#JkShmFile /var/cache/mod_jk/jk.shm

JkShmFile logs/jk.shm

JkMount status

#Order deny,allow

#Deny from all

#Allow from 127.0.0.1

#Allow from 192.168.1.0/24

Listen 10.7.60.55:8080

ManagerBalancerName mycluster

Order deny,allow

Deny from all

Allow from 127.0.0

KeepAliveTimeout 300

MaxKeepAliveRequests 0

#ServerAdvertise on http://@IP@:6666

AdvertiseFrequency 5

#AdvertiseSecurityKey secret

#AdvertiseGroup @ADVIP@:23364

EnableMCPMReceive

SetHandler mod_cluster-manager

#Order deny,allow

#Deny from all

#Allow from 127.0.0cat workers.properties

# 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=8009

worker.node1.host=10.7.60.55

worker.node1.type=ajp13

worker.node1.ping_mode=A

worker.node1.lbfactor=1

# Define Node2

# modify the host as your host IP or DNS name.

worker.node2.port=8009

worker.node2.host=10.7.60.55

worker.node2.type=ajp13

worker.node2.ping_mode=A

worker.node2.lbfactor=1

# Load-balancing behavior

worker.loadbalancer.type=lb

worker.loadbalancer.balance_workers=node1,node2

worker.loadbalancer.sticky_session=True

#worker.loadbalancer.sticky_session_force=True

# Status worker for managing load balancer

worker.status.type=status

Setelah konfigurasi httpd sudah ditambahkan atau di copy dari file httpd.conf yang telah di edit, maka langkah selanjutnya adalah

edit file /opt/jboss-ews-2.1/httpd/conf/uriworkermap.properties  dan workers.properties menjadi sebagai berikut :

cat uriworkermap.properties

#/*=loadbalancer

/cluster-demo/*=loadbalancer

#/*=demo

 

cat workers.properties

 

# 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=8009

worker.node1.host=10.7.60.55

worker.node1.type=ajp13

worker.node1.ping_mode=A

worker.node1.lbfactor=1

 

# Define Node 2

# modify the host as your host IP or DNS name.

worker.node2.port=8009

worker.node2.host=10.7.60.55

worker.node2.type=ajp13

worker.node2.ping_mode=A

worker.node2.lbfactor=1

 

# Load-balancing behavior

worker.loadbalancer.type=lb

worker.loadbalancer.balance_workers=node1,node2

worker.loadbalancer.sticky_session=True

#worker.loadbalancer.sticky_session_force=True

 

# Status worker for managing load balancer

worker.status.type=status

 

Pada file diatas, kita harus define ip node 1 dan node 2 yang akan di cluster.

Restart apachectl

./apachectl restart

Kemudian masuk, kita hanya tinggal masukan alamat IP jboss ews di browser dan deploy satu aplikasi “cluster demo” untuk melihat kedua node telah tergabung dalam satu cluster.

Untuk info lebih lengkap mengenai training yang tersedia di i3, Anda dapat menghubungi langsung tim sales kami melalui halaman Contact Us.

Table of Contents

Share this article
Scroll to Top