Skip to content

Instantly share code, notes, and snippets.

@oeegee
Last active December 17, 2015 06:59
Show Gist options
  • Save oeegee/5569653 to your computer and use it in GitHub Desktop.
Save oeegee/5569653 to your computer and use it in GitHub Desktop.
Apache mod_cluster - JBossAS7.1.1연동
[mod_cluster setup]
참조 (httpd-2.4.x 위주, JBoss AS7 domain mode)
http://www.openlogic.com/blog/bid/247607/JBoss-AS7-Clustering-Using-mod_cluster-and-http-2-4-Part-1
http://www.openlogic.com/blog/bid/256141/JBoss-AS7-Clustering-Using-mod_cluster-and-http-2-4-Part-2
http://www.openlogic.com/blog/bid/270433/JBoss-AS7-Clustering-Using-mod_cluster-and-http-2-4-Part-3
http://tech-sketch.jp/2012/04/jbossas.html
참조 (JBoss AS7 standalone mode 위주)
http://middlewaremagic.com/jboss/?tag=mod_cluster-apache
http://middlewaremagic.com/jboss/?p=2147
참조 (JBoss AS7 advertiser 사용 시)
http://stackoverflow.com/questions/14356640/clerror-in-apache-mod-cluster
참조 (ec2 non-multicast environment)
https://community.jboss.org/thread/151660
참조 (ec2 gossiprouter 사용)
https://www.jboss.org/dms/judcon/presentations/Berlin2010/JUDCon2010Berlin_RunningJBossClusterintheCloud.pdf
http://docs.jboss.org/mod_cluster/1.2.0/html/native.config.html
https://gist.github.com/slok/1543449
https://docs.jboss.org/author/display/AS71/AS7+Cluster+Howto
http://blog.akquinet.de/2012/06/21/clustering-in-jboss-as7eap-6/
시스템프로퍼티 참조
https://docs.jboss.org/author/display/AS7/Command+line+parameters
http://confluence.openflamingo.org/pages/viewpage.action?pageId=5538599
다른 참조(아파치2.2.x 일)
http://www.mastertheboss.com/jboss-cluster/clustering-with-jboss-mod_cluster
JBossAS7 한글메뉴얼
http://confluence.openflamingo.org/display/JBOSSAS/Chapter+1%3A+Installing+JBoss+AS+7
[Maven2 설치]
root@ip-10-161-5-236:/home/ubuntu/down/mod_cluster# apt-get install maven2
[autoconf 설치]
root@ip-10-161-5-236:/home/ubuntu/down/mod_cluster/native/advertise# apt-get install autoconf
# mod_cluster source down & compile
root@ip-10-161-5-236:/# cd /home/ubuntu/down/
root@ip-10-161-5-236:/home/ubuntu/down# git clone https://github.com/modcluster/mod_cluster.git
Cloning into 'mod_cluster'...
remote: Counting objects: 11303, done.
remote: Compressing objects: 100% (4197/4197), done.
remote: Total 11303 (delta 4916), reused 11271 (delta 4891)
Receiving objects: 100% (11303/11303), 4.23 MiB | 734 KiB/s, done.
Resolving deltas: 100% (4916/4916), done.
cd mod_cluster
mvn package
cd /home/ubuntu/down/
mkdir /project/AA+/servers/mod_cluster
cd native/advertise
./buildconf
./configure --with-apxs=/project/AA+/servers/httpd-2.4.4/bin/apxs
make
cp mod_advertise.so /project/AA+/servers/httpd-2.4.4/modules/
cd ../mod_manager/
./buildconf
./configure --with-apxs=/project/AA+/servers/httpd-2.4.4/bin/apxs
make
cp mod_manager.so /project/AA+/servers/httpd-2.4.4/modules/
cd ../mod_proxy_cluster/
./buildconf
./configure --with-apxs=/project/AA+/servers/httpd-2.4.4/bin/apxs --prefix=/project/AA+/servers/httpd-2.4.4
make
cp mod_proxy_cluster.so /project/AA+/servers/httpd-2.4.4/modules/
--> 재시도
--prefix=/project/AA+/servers/httpd-2.4.4
cd ../mod_slotmem/
./buildconf
./configure --with-apxs=/project/AA+/servers/httpd-2.4.4/bin/apxs
make
cp mod_slotmem.so /project/AA+/servers/httpd-2.4.4/modules/
[httpd.conf 수정]
cd /project/AA+/servers/httpd-2.4.4/conf
vi httpd.conf
# 관련모듈 추가
------------------------------
Listen 6666 #mod_cluster manager port
#Include conf/extra/mod_cluster.conf ## httpd-vhost.conf에 내용 추가로 대체
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
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
------------------------------
[httpd-vhosts.conf 수정]
vi httpd-vhosts.conf
------------------------------
NameVirtualHost *:6666
<VirtualHost _default_:6666>
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Require ip 127.0.0.1
# Order allow,deny
# Allow from all
</Location>
KeepAliveTimeout 60
MaxKeepAliveRequests 0
EnableMCPMReceive
ManagerBalancerName mycluster
ServerAdvertise Off
#AdvertiseFrequency 5
#AdvertiseSecurityKey secret
</VirtualHost>
------------------------------
[서비스 확인]
Xshell:\> ping ec2-54-248-63-251.ap-northeast-1.compute.amazonaws.com
Ping ec2-54-248-63-251.ap-northeast-1.compute.amazonaws.com [54.248.63.251] 32바이트 데이터 사용:
curl localhost:6666/mod_cluster-manager
--> 응답이 오면 web 구성 OK
[JBoss AS7 mod_cluster 구성]
[war down]
https://github.com/jaysensharma/MiddlewareMagicDemos/blob/master/ClusterTest_WebApp/ClusterWebApp.war?raw=true
또다른 샘플
https://github.com/liweinan/cluster-demo
[서비스 확인]
root@ip-10-161-5-236:/project/AA+/servers/httpd-2.4.4/bin# curl ec2-54-248-63-251.ap-northeast-1.compute.amazonaws.com:6666/mod_cluster-manager
성공!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head>
<title>Mod_cluster Status</title>
</head><body>
<h1>mod_cluster/1.2.3.Beta1</h1><a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&refresh=10">Auto Refresh</a> <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DUMP&Range=ALL">show DUMP output</a> <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=INFO&Range=ALL">show INFO output</a>
<h1> Node standalone-node1 (ajp://127.0.0.1:8109): </h1>
<a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=ENABLE-APP&Range=NODE&JVMRoute=standalone-node1">Enable Contexts</a> <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DISABLE-APP&Range=NODE&JVMRoute=standalone-node1">Disable Contexts</a><br/>
Balancer: mycluster,LBGroup: ,Flushpackets: Off,Flushwait: 10000,Ping: 10000000,Smax: 26,Ttl: 60000000,Status: OK,Elected: 0,Read: 0,Transferred: 0,Connected: 0,Load: 100
<h2> Virtual Host 1:</h2><h3>Contexts:</h3><pre>/, Status: ENABLED Request: 0 <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DISABLE-APP&Range=CONTEXT&JVMRoute=standalone-node1&Alias=default-host&Context=/">Disable</a>
/ClusterwebApp, Status: ENABLED Request: 0 <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DISABLE-APP&Range=CONTEXT&JVMRoute=standalone-node1&Alias=default-host&Context=/ClusterwebApp">Disable</a>
</pre><h3>Aliases:</h3><pre>default-host
localhost
example.com
</pre><h1> Node standalone-node2 (ajp://127.0.0.1:8209): </h1>
<a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=ENABLE-APP&Range=NODE&JVMRoute=standalone-node2">Enable Contexts</a> <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DISABLE-APP&Range=NODE&JVMRoute=standalone-node2">Disable Contexts</a><br/>
Balancer: mycluster,LBGroup: ,Flushpackets: Off,Flushwait: 10000,Ping: 10000000,Smax: 26,Ttl: 60000000,Status: OK,Elected: 0,Read: 0,Transferred: 0,Connected: 0,Load: 100
<h2> Virtual Host 1:</h2><h3>Contexts:</h3><pre>/ClusterwebApp, Status: ENABLED Request: 0 <a href="/mod_cluster-manager?nonce=d51604ac-c88e-11e2-949f-59b445043651&Cmd=DISABLE-APP&Range=CONTEXT&JVMRoute=standalone-node2&Alias=default-host&Context=/ClusterwebApp">Disable</a>
</pre><h3>Aliases:</h3><pre>default-host
localhost
example.com
</pre></body></html>
-------------------------------------------------
[web app 확인]
curl ec2-54-248-63-251.ap-northeast-1.compute.amazonaws.com/ClusterwebApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment