Download - Cluster « JBoss

Transcript
  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 1/23

    RSSFeed

    HomeApache&Cluster

    SecurityJMS

    EJB&JPAUtility

    WebServiceGeneralJBoss

    MBeansOpenShiftJDBC

    DisclaimerWeblogictoJBossMigration

    Cluster

    4Sep/12

    HowtogetAllClusterNodeDetailsusingJMXinJBossAS7.1.2

    byAuthor_1underCluster,JbossAS7,JBossAS7,MBeans

    Hi,

    InJBossEAP5orAS6orpreviousreleasestherewasaconceptofPartitionNamewhichcouldbeusedtoget the listofactiveclustermembers,However inJBossAS7 there isnoconceptofPartitionNameratherinUDPmodethelusteringhappensbasedonthemulticastasddress(ClusteringcanbeachievedusingTCPmodeofcommunicationaswell).HowevermanydeveloperswanttolistthenumberofactivemembersrunningaspartofaJBossAs7clusterprogramatically.

    So in this examplewewill see how towrite a simple JMXCode in order to access the cluster node

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 2/23

    details.

    NOTE:

    Point1).InJBossAS7untilyoudeployanapplicationwhichrequiresclusteringtheJBosswillnowstarttheclusteringservices.SoincaseofwebApplicationsyoushoulddeployatleastoneapplicationon

    yourClustermemberswhichhastagspecifiedinitsWEBINF/web.xmlfile.

    Point2).IfyouareusingEJBs(andnotwebapplicationtodeployonyourcluster)makesurethattheEJBsareclusteredinordertostartClusterservices.EJBscanbeannotatedusingthefollowing

    annotationinordertobeclustered.@org.jboss.ejb3.annotation.Clustered

    Point3).InCaseofWebBasedclustertheObjectNameoftheClusteredinstancewillbejgroups:type=channel,cluster=webbydefaultwhichcanbeusedintheJMXCodeinordertolook

    querytheMBean.

    Point3).InCaseofEJBBasedclustertheObjectNameoftheClusteredinstancewillbejgroups:type=channel,cluster=ejbbydefaultwhichcanbeusedintheJMXCodeinordertolook

    querytheMBean.

    Point5).IfyouarerunningyourServerinDomainModethenyoushouldnotusetheNativeManagementPort9999inordertoquerytheMBeansratheryoushouldusetheindividualservers

    RemotingPort4447inyourJMXCode.byaddingthefollowingconfigurationonyourJBossProfileinsidedomain.xmlyoucanallowaccessingtheMBeansviaRemotingport4447ratherthan(native

    managementport9999)

    Point6).IfyouareusingNativeManagementInterfaceport9999inordertoqueryyourClusterMBean(instandalonemode)thenyoushouldusetheCredentials(username/password)forauserbelongingto

    ManagementRealm,ButinDomainmodeasweneedtoconnecttoserverusingRemotingPort(4447)soyoushouldcreateaApplicationRealmuser.inalltheclusterHosts.

    WritingtheJMXcodcetoqueryClusterMBean

    1 2 3 4

    01 importjava.util.Hashtable;02 importjavax.management.MBeanServerConnection;03 importjavax.management.ObjectName;04 importjavax.management.remote.JMXConnector;05 importjavax.management.remote.JMXConnectorFactory;06 importjavax.management.remote.JMXServiceURL;07 08 publicclassAS7ClusterView{09 publicstaticvoidmain(String[]args)throwsException{10 11 Stringhost="10.10.10.10";//YourJBossNativeInterfaceBinAddressdefaultislocalhost12 intport=9999;//managementport//InDomainModeyoushoulduse4447portofindividualserver13 StringurlString="service:jmx:remotingjmx://"+host+":"+port;

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 3/23

    NowopenaTerminalwhereweneedtosetthePAThandCLASSPATHlikefollowingandthencompileandruntheprogram:

    .

    .Thanks

    MiddlewareMagicTeam

    Cluster,JbossAS7,JBossAS7,MBeansLeaveaCommentmore...

    3Jul/12

    14 System.out.println("\n\n\t****urlString:"+urlString);15 StringwebClusterObjectName="jgroups:type=channel,cluster=\"web\""16 //StringejbClusterObjectName="jgroups:type=channel,cluster=\"ejb\"";17 18 JMXServiceURLserviceURL=newJMXServiceURL(urlString);19 20 Hashtableh=newHashtable();21 String[]credentials=newString[]{"admin","admin123"};22 h.put("jmx.remote.credentials",credentials);23 24 JMXConnectorjmxConnector=JMXConnectorFactory.connect(serviceURL,25 MBeanServerConnectionconnection=jmxConnector.getMBeanServerConnection();26 ObjectNameobjectName=newObjectName(webClusterObjectName);27 StringclusterView=(String)connection.getAttribute(objectName,28 LongreceivedMessages=(Long)connection.getAttribute(objectName,29 Stringname=(String)connection.getAttribute(objectName,"Name"30 StringclusterName=(String)connection.getAttribute(objectName,31 32 System.out.println("clusterView="+clusterView);33 System.out.println("receivedMessages="+receivedMessages);34 System.out.println("name="+name);35 System.out.println("clusterName="+clusterName);36 jmxConnector.close();37 }38 39 }

    01 ForUNIXBasedOperatingSystem:02 03 exportPATH=/home/userone/jdk1.6.0_21/bin:$PATH04 exportCLASSPATH=/home/userone/jbossas7.1.2.Final/bin/client/jbossclient.jar:$CLASSPATH:.:05 06 ++++++++++++++++++++++++++++++++07 ForWindowsBasedOperatingSystem08 09 setPATH=C:\jdk1.6.0_21\bin;%PATH%10 setCLASSPATH=c:\jbossas7.1.2.Final\bin\client\jbossclient.jar;%CLASSPATH%;.;

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 4/23

    Usingmod_clusterwithJBossAS7.1cluster

    byAuthor_2underApache,Cluster,JbossAS7,mod_cluster,WebServer

    Wehaveseenhowtocreateclustersinstandalone,domainwithmulticastandunicastprotocolsalsowhichhavebeenlistedbelow.Howeverinthisarticlewewouldbeseeinghowto

    usemod_clusterwithourcreatedclustersinbothstandaloneanddomainmode.

    FollowingarethelistofarticlewehavecreatedtillnowforcreatingaclusterinJBossAS7.1.1Finaltillnow

    1. HowtocreateclusterinJBossAS7.1instandalonemode?2. HowtocreateclusterinJBossAS7.1indomainmode?3. CreatingTCPclusterinJBossAS7.1instandalonemode?

    AgainwewouldbeusingJBossAS7.1.1.Finalforthisarticleaswellsothatweareallonthesamepage,asfewthingshavebeenchangefromJBossAS7.0toJBossAS7.1.

    Changestakenplace:

    1. AJPconnectorisenabledbydefaultinstandaloneha.xml,standalonefullha.xmlanddomain.xmlforhaandfullhaprofile.

    2. InsteadofJVMRoute,nowwehavetouseinstanceid

    Usingmod_clusterwithJBossAS7.1clusterForthiswewouldhavetomodifyfrombothsideApacheaswellasJBossAS7side,henceletsseethe

    configurationoneatatime

    Apachesideconfiguration

    LetsseewhatallconfigurationhastobemadefromApacheside

    1. Youcanconfiguremod_clusterfromthebelowarticle,justfollowtheApachesideconfigurationpartonly

    Howtoconfiguremod_clusterwithJBoss?

    2. IntheabovearticleyoucanjustaddtheIP_ADDRESSoftheboxonwhichApacheisrunningwhichisintheStep3somethingasshownbelow

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 5/23

    JBosssideconfiguration

    NowwewouldseewhatallchangeswehavetobedonefromJBossendinstandaloneanddomainfiles

    Standalone

    1. FirstyouwouldhavetofollowallthestepsgiveninthelinkHowtocreateclusterinJBossAS7.1instandalonemode?andthenmakethebelowchangesinallthestandaloneservers.

    2. Giveauniquenameintheserverelement,asshownbelow.

    standalonenode1

    standalonenode2

    3. Astoldearlieryouwouldhavetoaddtheinstanceidattributeinwebsubsystemasshownbelowinboththestandalonenodes.

    01 ###############mod_clusterSettingSTARTED###############02 LoadModuleslotmem_modulemodules/mod_slotmem.so03 LoadModulemanager_modulemodules/mod_manager.so04 LoadModuleproxy_cluster_modulemodules/mod_proxy_cluster.so05 LoadModuleadvertise_modulemodules/mod_advertise.so06 07 Listen1.1.1.1:8008 09 10 11 Orderdeny,allow12 Allowfromall13 14 15 SetHandlermod_clustermanager16 Orderdeny,allow17 Allowfromall18 19 KeepAliveTimeout6020 ManagerBalancerNamemycluster21 ServerAdvertiseOn22 23 ###############mod_clusterSettingENDED###############

    1

    1

    1

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 6/23

    4. Lastyoujusthavetoaddtheproxylistintheattributeinmodclusterconfigofmodclustersubsystem,whichwouldbehavingIPAddressandPortonwhichyourApacheserverisrunningso

    thatJBossservercancommunicatewithit,asshownbelowinboththestandalonenodes.

    IfeverythingisconfiguredproperlyyoucanhittheURL=http://1.1.1.1/mod_clustermanagerwhichwouldshowsimilarbelowscreen.Belowimageisshowingwhenclusterisbeenmadeinonthesame

    boxusingstandalonemode

    mod_clusterforStandaloneonthesamebox

    Domain

    1. FirstyouwouldhavetofollowallthestepsgiveninthelinkHowtocreateclusterinJBossAS7.1indomainmode?andthenmakethebelowchangesinyourdomainfile.

    2. Wewouldhavetoaddtheinstanceidattributeinwebsubsystemasshownbelowindomain.xmlfortherespectiveprofilehaandfullhawhichisbeenused.

    3. Lastyoujusthavetoaddtheproxylistintheattributeinmodclusterconfigofmodclustersubsystem,whichwouldbehavingIPAddressandPortonwhichyourApacheserverisrunningso

    7

    1 2

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 7/23

    thatJBossservercancommunicatewithit,asshownbelowindomain.xmlfortherespectiveprofilehaandfullhawhichisbeenused.

    IfeverythingisconfiguredproperlyyoucanhittheURL=http://1.1.1.1/mod_clustermanagerwhichwouldshowsimilarbelowscreen.Belowimageisshowingwhenclusterisbeenmadeinonthesame

    boxaswellasinremoteboxusingdomainmode.

    SameBox

    mod_clusterforDomainmodeonthesamebox

    RemoteBox

    mod_clusterforDomainmodeonRemotebox

    Testing

    InallourpreviousarticlewehadaskedyoutouseoneofourapplicationcalledClusterWebAp,thisisthetimewhenwewouldbetestingifourclusterisworkingproperlywithmod_clusterconfiguration.

    1 2

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 8/23

    1. OnceeverythingthingisbeenconfiguredandhavebeenstartedupproperlyyoucanhittheapplicationusingApacheURLasshownbelowandyouwouldseesomethinglikeinthesnapshot

    ClusterWebApp

    2. Supposethefirstrequestgoestostandalonenode2,youcanseethereisasessionidwhichisbeengenerated.Nowyoujusthavetoshutdownyourstandalonenode2andthenclickonthelink

    ClickHeretomovetonextPagesessionCheck.jsponthesamepage.3. Onceyouclickonthelink,youwillnoticethattherequesthasbeenservedbythestandalone

    node1thistimeasnode2hadbeenbroughtdown,butthesessionidremainsthesamewhichwascreatedearlierhavingthesametimestampasshownbelow

    SessionReplication

    WiththistestitisclearthatourclusterisworkingfineasthesessionreplicationishappeningproperlyonJBossusingmod_cluster.

    Issuesyoumightface

    Ifyouhavenotgiventheinstanceidinthedomain.xmlfileforhaorfullhaandhaveastepupaclusterwhichishavingamod_clusterinfrontofthemyoumightgetthefollowingerrorinthelogs.

    1 http://1.1.1.1/ClusterWebApp

    1 [Server:haserver1]20:29:36,429ERROR[org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler](ContainerBackgroundProcessor[StandardEngine[jboss.web]])Error[MEM:MEM:Oldnodestillexist:{2 [Server:haserver2]20:29:37,426ERROR[org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler](ContainerBackgroundProcessor[StandardEngine[jboss.web]])Error[MEM:MEM:Can'treadnode:{3 [Server:haserver2]20:29:47,432ERROR[org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler](ContainerBackgroundProcessor[StandardEngine[jboss.web]])Error[MEM:MEM:Oldnodestillexist:{4 [Server:haserver1]20:29:56,441ERROR[org.jboss.modcluster.mcmp.impl.DefaultMCMPHandler](ContainerBackgroundProcessor[StandardEngine[jboss.web]])Error[MEM:MEM:Can'treadnode:{

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 9/23

    Forthisyoujusthavetofollowthestep2ofDomainconfiguration,whichwouldfixthisissue.

    Apache,Cluster,JbossAS7,JBossAS7,mod_cluster2Commentsmore...

    11Jun/12

    CreatingTCPclusterinJBossAS7.1instandalonemode?

    byAuthor_2underCluster,JbossAS7,JBossAS7

    InmypreviousarticlewehadseenHowtocreateclusterinJBossAS7.1instandalonemode?whichwasusingUDPprotocol.

    BydefaultJBossAS7usesUDPprotocol,butforsecurityconstrainssomecompaniesdonotopen/allowtouseUDPprotocolormulticastaddresses,henceduringthattimeTCPprotocolorunicastaddresscan

    beusedtocreateaclusterwhichisalsosupportedbyJBossAS7.

    InthisarticlewewouldbeshowingyouhowyouusestandalonemodetocreateaclusterusingTCPprotocol.Howeverasweallknowinstandalonemodewehavedifferentxmlfilesunderthe

    configurationfolderfromwhichclusterisenabledinstandaloneha.xmlandstandalonefullha.xml,thusmakesureyouwouldbeusingthemandnototherxmlfiles.

    InthisarticlewewouldbeusingJBossAS7.1.1FinalwhichisthelatestversionofJBossincommunityversion.

    StepstocreateaTCPclusterinJBossAS7.1instandalonemode

    Wewouldbeseeingtwoscenarioshereonewouldbecreatingaclusteronthesameboxandsecondwhencreatingaclusterbetweendifferentboxes.

    Scenario1:Clusteronsamebox

    1. Onceyouhaveunzippedjbossas7.1.1.Final.zip,youwouldhavetocreatetwocopiesofstandalonefolderandrenamethemasstandalonenode1andstandalonenode2asshownbelow

    Note:Makesureyoukeeptheoriginalcopyforstandalonefolderasitisforfutureusage.

    1 /home/user/jbossas7.1.1.Final/standalonenode12 /home/user/jbossas7.1.1.Final/standalonenode2

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 10/23

    2. Inboththestandalonenodexyouwouldhavetomakethefollowingchangesinstandaloneha.xmlfilestotellJBosstostarttheclusterinTCPprotocol

    From:

    To:

    01

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 11/23

    Note:Followingarethechangesmade

    1. Wehavereplaceddefaultstack=udptodefaultstack=tcpinthesubsystemelement.2. AndaddedTCPPINGprotocolelementwithitssubelements

    Where:initial_hosts=isalistofcommaseperatedcomboofIP_ADDRESSandPORTforpinging.

    num_initial_members=specifiesthemaximumnumberofresponsestowaitfor.port_range=specifiestherangeofportstopingoneachhostintheinitial_hostslist.timeout=specifiesthemaximumnumberofmillisecondstowaitforanyresponses.

    3. NowyouwouldhavetorunthebelowcommandtostartboththeJBossnodeinacluster

    Node1

    Node2

    Where:c=isforserverconfigurationfiletobeused

    b=isforbindingaddressDjboss.server.base.dir=isforthepathfromwherenodeispresent

    Djboss.node.name=isforthenameofthenodeDjboss.socket.binding.portoffset=isfortheportoffsetonwhichnodewouldberunning

    Note:Howeverweneedtokeepinmindthefollowingthings

    1. Boththenodesshouldhaveuniquenodenames2. Boththenodesshouldhaveuniquesocketbindingportoffsetsastheyarerunningonthe

    samebox4. Onceboththenodecomesupproperlyyouwouldnotseethemincluster,hencetomakesureif

    bothofthenodesareinaclusterthenyouwouldneedtodeploytheanapplicationwhichhasthedistributabletaginweb.xml.Youcandownloadoneofoursampleclusteredapplicationby:

    clickinghere5. AfterdownloadingtheClusterWebApp.waryoujusthavetokeepitin(/home/user/jbossas

    7.1.1.Final/standalonenodeX/deployments)bothnodesdeploymentsfolder,justafterthatyouwouldseesimilarbelowmessagesinboththenodesprompt,havingbothnodenamesinthere

    clusterview.

    22 23 24 25 26 27 28

    1 ./standalone.shcstandaloneha.xmlb10.10.10.10Djboss.server.base.dir=../standalone

    1 ./standalone.shcstandaloneha.xmlb10.10.10.10Djboss.server.base.dir=../standalone

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 12/23

    Scenario2:Clusterondifferentboxes

    1. AfterunzippingJBossAS7inboththeboxes[i.e.box1=10.10.10.10andbox2=20.20.20.20]thenyoucancreatejustasinglecopiesofstandalonefolderinrespectiveboxes

    Box1:10.10.10.10

    Box2:20.20.20.20

    2. InboththestandalonenodexyouwouldhavetofollowthesameStep2ofScenario1,howeveronlyonechangewouldbethereininitial_hostsyouwouldhavetogivebothboxes

    IP_ADDRESSasshownbelow

    3. NowyouwouldhavetorunthebelowcommandtostartboththeJBossnodeinacluster

    Node1onBox1[10.10.10.10]

    Node2onBox2[20.20.20.20]

    Note:Howeverweneedtokeepinmindthefollowingthings

    1. Boththenodesshouldhaveuniquenodenames2. BoththenodesshouldberunningontheIP_ADDRESSorHOST_NAMEofthebox

    Herewewouldnothavetoworryabouttheportconflictsaswearerunningboththenodeson

    1 21:49:11,988INFO[stdout](pool14thread1)2 21:49:11,989INFO[stdout](pool14thread1)GMS:address=node2/web,cluster=web,physicaladdress=3 21:49:11,989INFO[stdout](pool14thread1)4 .5 .6 21:49:15,954INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](pool7 .

    1 /home/user/jbossas7.1.1.Final/standalonenode1

    1 /home/user/jbossas7.1.1.Final/standalonenode2

    1 2 10.10.10.10[7600],20.20.20.20[7600]

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 13/23

    differentboxeshavingdifferentbindingaddress.

    4. Repeatthesamestep4andstep5ofScenario1andyouwouldthenseethesameclusterviewineachrunningnodesprompts.

    Cluster,JbossAS7,JBossAS71Commentmore...

    11Jun/12

    HowtocreateclusterinJBossAS7.1indomainmode?

    byAuthor_2underCluster,JbossAS7,JBossAS7

    InmylastarticlewehadseenHowtocreateclusterinJBossAS7.1instandalonemodenowinthisarticlewewouldbedoingthesamebutindomainmode.

    Indomainmodewewouldbeusingtwomainxmlfilescalleddomain.xmlandhost.xmlfileswhichhastobeusedforcreatingthiscluster.

    InthisarticlewewouldbeusingJBossAS7.1.1FinalwhichisthelatestversionofJBossincommunityversion.NowletsseehowcanwecreateclusterinJBossAS7.1indomainmode.

    StepstocreateaclusterinJBossAS7.1indomainmode

    Wewouldbeseeingtwoscenarioshereonewouldbecreatingaclusteronthesameboxandsecondwhencreatingaclusterbetweendifferentboxes.

    Scenario1:Clusteronsamebox

    1. Downloadandunzippedjbossas7.1.1.Final.zip2. Nowin/home/user/jbossas7.1.1.Final/domain/configuration/domain.xmlfilemakethebelow

    changes,whichisjustaddinganewservergroup(i.e.haservergroup)whichwouldbeusinghaprofileandhasocketssocketbindinggroup,wherehaisforclusterenabled.

    01

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 14/23

    Where:

    1. profile:tellswhichtypeofprofileisbeenused(i.e.web,messaging,cluster,full)2. socketbindinggroup:tellswhichalltypeofprotocolsisbeenused(i.e.web[http,ajp],

    messaging,jgroups[udp,tcp],full)3. servergroup:tellswhatprofileisbeenusedandwhattypeofsocketsisbeenused

    3. Afterthatyouwouldhavetomakethebelowchangesin/home/user/jbossas7.1.1.Final/domain/configuration/host.xmlfilewhichisjustaddingtwonewJBossnodeswiththenamehaserver1andhaserver2whichareusingthehaservergroupservergroupcreatedin

    thepervioussetpandmakingthisserversclusterdenabled

    Note:Youaregivinguniquenameandportoffsetfortheseservers,asboththeserversarerunningonthesamebox.

    4. CreateaManagementUserusingtheadduser.shscriptasshownbelow.Thisisdonesothatwecanaccessadminconsole.

    02 03 04 05 06 07 08 .09 .10

    01 02

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 15/23

    5. Onceeverythingisdonestartyourserverbyusingthebelowcommand,howeveryouwouldnotseethatthenodeshaserver1andhaserver2areinaclusterforthatyouwouldhavetodeploy

    anapplicationwhichhasthedistributabletaginweb.xml.

    6. Nowyoucandownloadoneofoursampleclusteredapplicationby:clickinghereanddeployitfromadminconsolefromtheURLhttp://localhost:9990/console

    Addingtheapplication

    Choosingapplicationfile

    12 ReenterPassword:testpassword13 Abouttoadduser'testuser'forrealm'ManagementRealm'14 Isthiscorrectyes/no?yes15 Addeduser'testuser'tofile'/home/user/jbossas7.1.1.Final/standalone/configuration/mgmtusers.properties'16 Addeduser'testuser'tofile'/home/user/jbossas7.1.1.Final/domain/configuration/mgmtusers.properties'

    1 ./domain.sh

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 16/23

    Verifyingthedeployedapplicaitonname

    Addingthedeployedapplicaitontoaservergroup

    Selectinghaservergroupforgettingtheapplicationdeployed

    7. Justafterdeployingapplicationandaddingittohaservergroupyouwouldseethebelowclusterviewinthepromptinwhichthedomainisrunning.

    1 [Server:haserver2]15:12:33,971INFO[org.jboss.web](MSCservicethread2 [Server:haserver2]15:12:34,239INFO[org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.web](Incoming3 [Server:haserver2]15:12:34,242INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](Incoming4 .5 .6 [Server:haserver1]15:12:34,377INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](pool

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 17/23

    Scenario2:Clusterondifferentboxes

    1. AfterunzippingJBossAS7inboththeboxes[i.e.box1=10.10.10.10andbox2=20.20.20.20]choosewhichoneoftheboxeswouldbeworkingasadomaincontrollerandotherashost

    controller2. Supposeyouchoosebox1[10.10.10.10]asdomaincontrollerthenyouwouldhavetofollow

    Step2andStep3ofScenario1,creatingonlyoneJBossserverwhichishaserver13. Forthebox2[20.20.20.20]whichwouldbeworkingasahostcontrollerhavingthenamehost1,

    nowonlyfollowStep3ofScenario1,thisisbecausewewouldbeusingdomain.xmlofthedomaincontrollerandcreatingtheotherJBossserverwhichishaserver2.

    4. OnceyouhavedonewiththeabovechangesyouwouldhavetofollowthestepsgiveninthearticleHowtostartJBossAS7.1indomainmode?andthebelowimagewouldgiveyouabetter

    understandingofthearchitecture

    5. NowthelastthingwhichyouwouldhavetodoistodeploytheapplicationusingtheconsolewhichwouldberunninginthedomaincontrollerhenceyouwouldbeusingtheURL

    http://10.10.10.10:9990/consoleandrepeattheStep6ofScenario16. Onceeverythingisdoneproperlyyouwouldseesimilarbelowlinesinrespectivepromptsof

    domainandhostcontroller

    Cluster,JbossAS7,JBossAS72Commentsmore...

    6Jun/12

    HowtocreateclusterinJBossAS7.1instandalonemode?

    byAuthor_2underCluster,JBossAS7

    7 [Server:haserver1]15:12:34,378INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](pool

    1 [Server:haserver1]19:39:29,458INFO[org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.web](Incoming

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 18/23

    WehaveseenthatJBossAS7istotallydifferentthentheearlierversionsofJBoss,henceifyouwanttocreateaclusterinJBossAS7therearefewthingswhichhasbeenchange

    andhastobeknownorelseyouwouldfaceissues.

    InJBossAS7wehavebydefaulttwomodeswhicharedomainmodeandstandalonemode,inthisarticlewewouldbeusingstandalonemode.Howeverinstandalonemodealsowehavedifferentxml

    filesundertheconfigurationfolderfromwhichclusterisenabledinstandaloneha.xmlandstandalonefullha.xml,thusmakesureyouwouldbeusingthemandnototherxmlfiles.

    InthisarticlewewouldbeusingJBossAS7.1.1FinalwhichisthelatestversionofJBossincommunityversion.NowletsseehowcanwecreateclusterinJBossAS7.1

    StepstocreateaclusterinJBossAS7.1

    Wewouldbeseeingtwoscenarioshereonewouldbecreatingaclusteronthesameboxandsecondwhencreatingaclusterbetweendifferentboxes.

    Scenario1:Clusteronsamebox

    1. Onceyouhaveunzippedjbossas7.1.1.Final.zip,youwouldhavetocreatetwocopiesofstandalonefolderandrenamethemasstandalonenode1andstandalonenode2asshownbelow

    Note:Makesureyoukeeptheoriginalcopyforstandalonefolderasitisforfutureusage.

    2. NowyouwouldhavetorunthebelowcommandtostartboththeJBossnodeinacluster

    Node1

    Node2

    Where:c=isforserverconfigurationfiletobeused

    b=isforbindingaddress

    1 /home/user/jbossas7.1.1.Final/standalonenode12 /home/user/jbossas7.1.1.Final/standalonenode2

    1 ./standalone.shcstandaloneha.xmlb10.10.10.10u230.0.0.4Djboss.server.base.dir=../standalonenode1Djboss.node.name=node1Djboss.socket.binding.portoffset=

    1 ./standalone.shcstandaloneha.xmlb10.10.10.10u230.0.0.4Djboss.server.base.dir=../standalonenode2Djboss.node.name=node2Djboss.socket.binding.portoffset=

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 19/23

    u=isformulticastaddressDjboss.server.base.dir=isforthepathfromwherenodeispresent

    Djboss.node.name=isforthenameofthenodeDjboss.socket.binding.portoffset=isfortheportoffsetonwhichnodewouldberunning

    Note:Howeverweneedtokeepinmindthefollowingthings

    1. Boththenodesshouldhavesamemulticastaddress2. Boththenodesshouldhavedifferentnodenames3. Boththenodesshouldhavedifferentsocketbindingportoffsets

    3. Onceboththenodecomesupproperlyyouwouldnotseethemincluster,hencetomakesureifbothofthenodesareinaclusterthenyouwouldneedtodeploytheanapplicationwhichhasthedistributabletaginweb.xml.Youcandownloadoneofoursampleclusteredapplicationby:

    clickinghere4. AfterdownloadingtheClusterWebApp.waryoujusthavetokeepitin(/home/user/jbossas

    7.1.1.Final/standalonenodeX/deployments)bothnodesdeploymentsfolder,justafterthatyouwouldseesimilarbelowmessagesinboththenodesprompt,havingbothnodenamesinthere

    clusterview.

    Scenario2:Clusterondifferentboxes

    1. AfterunzippingJBossAS7inboththeboxes[i.e.box1=10.10.10.10andbox2=20.20.20.20]thenyoucancreatejustasinglecopiesofstandalonefolderinrespectiveboxes

    Box1:10.10.10.10

    Box2:20.20.20.20

    2. NowyouwouldhavetorunthebelowcommandtostartboththeJBossnodeinaclusterNote:Howeverweneedtokeepinmindthefollowingthings

    1. Boththenodesshouldhavesamemulticastaddress2. Boththenodesshouldhavedifferentnodenames3. BoththenodesshouldberunningontheIP_ADDRESSorHOST_NAMEofthebox

    Node1onBox1[10.10.10.10]

    1 18:32:46,863INFO[stdout](pool13thread1)2 18:32:46,863INFO[stdout](pool13thread1)GMS:address=node1/web,cluster=web,physicaladdress=3 18:32:46,863INFO[stdout](pool13thread1)4 18:32:47,572INFO[org.infinispan.configuration.cache.EvictionConfigurationBuilder](MSCservicethread5 18:32:47,581INFO[org.infinispan.configuration.cache.EvictionConfigurationBuilder](MSCservicethread6 18:32:47,771INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](pool7 18:32:47,791INFO[org.infinispan.remoting.transport.jgroups.JGroupsTransport](pool

    1 /home/user/jbossas7.1.1.Final/standalonenode1

    1 /home/user/jbossas7.1.1.Final/standalonenode2

    1 ./standalone.shcstandaloneha.xmlb10.10.10.10u230.0.0.4Djboss.server.base.dir=../standalonenode1Djboss.node.name=node1

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 20/23

    Node2onBox2[20.20.20.20]

    Herewewouldnothavetoworryabouttheportconflictsaswearerunningboththenodesondifferentboxeshavingdifferentbindingaddress.

    3. Repeatthesamestep3andstep4ofScenario1andyouwouldthenseethesameclusterviewineachrunningnodesprompts.

    Ifyouarelookingforrunningmultipleclusters,thenyouwouldhavetomakesureyougiveadifferentsetofmulticastaddress(i.euoption)foreachcluster.

    Cluster,JbossAS7,JBossAS75Commentsmore...

    24Dec/11

    HowtofixWARNING[org.hornetq.core.server.impl.HornetQServerImpl](MSCservice

    thread15)Securityrisk!inJBossAS7

    byAuthor_2underBignners,Cluster,HornetQ,JbossAS7,JBossAS7,JMS,security

    IfyouhavestartedJBossAS7.1.0.CR1standalonefull.xmlprofileyoumusthavenoticedthatyouwouldbegettingthebelowWARNINGmessage.Howeverasthisjustawarningmessageandwouldnothamperyoursetupbutwarningisawarning,henceIhadtolookwhythiswascomingupwhenIwas

    startingthedefaultstandalonefull.xmlprofilethusstartedmyinvestigation,ifyouguysrememberthatinearlierversionsofJBosshadasimilarwarningwhichwassuckerpasswordwhichcanbefixedby

    goingthroughthisarticleHowtosetJBossMessageSuckerPasswordinJBossAS6,similarlywecanevenfixthiswarningmessagebyfollowingthebelowsteps.

    .

    WarningMessage:

    1 ./standalone.shcstandaloneha.xmlb20.20.20.20u230.0.0.4Djboss.server.base.dir=../standalonenode2Djboss.node.name=node2

    1 22:34:54,728INFO[org.apache.coyote.http11.Http11AprProtocol](MSCservicethread2 22:34:54,876WARNING[org.hornetq.core.server.impl.HornetQServerImpl](MSCservicethread3 22:34:55,045INFO[org.jboss.as.jacorb](MSCservicethread18)CORBAORBServiceStarted4 22:34:55,276INFO[org.jboss.as.jacorb](MSCservicethread16)CORBANamingServiceStarted

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 21/23

    Stepstofixthiswarningmessage:ByjustfollowingthewarningmessagesaysandaddtheclusteruserandpasswordfortheHornetqto

    overcomethisissue

    1. Stopyourrunningserver2. Open/jbossas7.1.0.CR1/standalone/configuration/standalonefull.xmlfile3. Nowjustaddclusteruserandclusterpasswordtagswithitsvalueunderhornetqserveras

    shownbelow

    4. Restartyourserverusingthebelowcommand

    Youwouldnoticenowthewarningmessagewhichwascomingearlierhasbeenfixed.

    Regards,MiddlewareMagic

    HornetQ,JbossAS7,JBossAS7,securityLeaveaCommentmore...

    Searchkeywords Search

    ReceiveFREEUpdates

    FREEEmailupdatesofournewposts Enteryouremailaddress: Subscribe

    01 02 admin03 admin104 05 false06 07 10240008 209 .10 .

    1 ./standalone.shcstandalonefull.xml

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 22/23

    MagicAccount

    RegisterLogin

    EntriesRSSCommentsRSSWordPress.org

    TopMagicUsers

    nikhilmone(Magic705)MarilynMc(Magic145)AlbertoTh(Magic125)

    FeliciaMcGregor(Magic110)sumitbhat(Magic100)acewin(Magic90)

    CharlineB(Magic90)NewtonGower(Magic90)MarylynJ5(Magic85)

    BennieEaster(Magic80)

    MagicArchivesSelectMonth

    RecentTech.Discussion

    MiddlewareMagic

    1,815peoplelikeMiddlewareMagic.

    Facebooksocialplugin

    Like

  • 5/21/2015 ClusterJBoss

    http://middlewaremagic.com/jboss/?cat=8 23/23

    Author_2onHowtostartJBossAS7.1indomainmode?godpusaonHowtostartJBossAS7.1indomainmode?

    mabonInstallandRunTomcatonOpenshiftcguZZmanonConfiguringHttpsConnectorusingCLIonJBossAS7.1.2&TestingwithJava

    TestClientAuthor_2onApache&Cluster

    amitvronSimplifiedwayofEJBRemoteLookupinJBossAS7.1.0.FinalAuthor_2onHowtocreateclusterinJBossAS7.1indomainmode?skyrocketonHowtocreateclusterinJBossAS7.1indomainmode?

    WhyI#39mgettingERR_TOO_MANY_REDIRECTSinmyapplicationhostedonOPENSHIFT|CodeandProgrammingonInstallandRunTomcatonOpenshift

    kanthionApache&ClustervpnonHowtorunmultipleJBossAS7.1asaserviceonsingleboxinLinuxvpnonHowtorunmultipleJBossAS7.1asaserviceonsingleboxinLinux

    Author_2onApache&ClusterAuthor_2onHowtorunmultipleJBossAS7.1asaserviceonsingleboxinLinux

    kanthionApache&Cluster

    RecentPosts

    HowtolistallthedeploymentsbelongstoanyservergroupinWildFly8.2usingjavacode?HowtofindServerStateinWildFly8.2usingModelControllerClient?

    JBossAS7ClusteringonOpenShiftIntegrateyourEclipseJunoIDEwithOpenshift

    HowtoloadjarsresidingoverNFSinJBossAS7classpath?

    Tags

    ApacheCLIClusterCXFDatabaseDatasourceejb3HornetQjbossJBossAS6JBossAS6JbossAS7JBossAS7JBossMessagingJMSJMXJSP/ServletsloggingMBeansMDBmonitoringOpenShiftsecurity

    WebService

    Copyright20102012MiddlewareMagic.Allrightsreserved.|Disclaimer