{"id":13121,"date":"2019-12-03T23:43:34","date_gmt":"2019-12-03T22:43:34","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/"},"modified":"2019-12-03T23:43:34","modified_gmt":"2019-12-03T22:43:34","slug":"jboss-eap-7-cluster-in-standalone-mode","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/","title":{"rendered":"JBoss EAP 7 &#8211; Cluster in Standalone mode"},"content":{"rendered":"<p>Usually, when we speak about Standalone mode we imagine that it can&#8217;t be clustered&#8230; In fact, with JBoss it is possible, the clustering functionality is configured by default in the HA-based profiles: standalone-ha.xml and standalone-full-ha.xml.<br \/>\n<!--more--><br \/>\nI would like to share with you two cluster scenarios:<br \/>\n\t&#8211; Scenario 1: Two Standalone instances on one VM<br \/>\n\t&#8211; Scenario 2: Two Standalone instances on two VMs<\/p>\n<p>First of all, you have to install JBoss, I installed the JBoss EAP 7.0.0 on \/opt\/JBoss-eap-7.<\/p>\n<p>In the JBoss home directory there is a standalone folder, which is the default standalone instance location. So, the below command will start a default standalone instance with a default profile (standalone.xml):<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n\/opt\/install\/jboss-eap-7\/bin\/standalone.sh\n<\/pre>\n<p><em>Don&#8217;t execute it, to keep the default folder as it is for future usage.<\/em><\/p>\n<h1>Scenario 1: Two Standalone instances on one VM<\/h1>\n<p>We will create two copies of standalone folder and rename them as node1 and node2 as shown below:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\ncp -rp \/opt\/install\/jboss-eap-7\/standalone \/opt\/install\/node1\ncp -rp \/opt\/install\/jboss-eap-7\/standalone \/opt\/install\/node2\n<\/pre>\n<p><em>It is recommended to put instance folder outside the JBoss home directory.<\/em><\/p>\n<p>Below commands will start both JBoss nodes in a cluster:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n\/opt\/install\/jboss-eap-7\/bin\/standalone.sh -c standalone-ha.xml -Djboss.server.base.dir=\/opt\/install\/node1 -Djboss.bind.address=vmtestjboss -Djboss.bind.address.management=vmtestjboss -Djboss.node.name=node1 -Djboss.socket.binding.port-offset=1\n<\/pre>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n\/opt\/install\/jboss-eap-7\/bin\/standalone.sh -c standalone-ha.xml -Djboss.server.base.dir=\/opt\/install\/node2 -Djboss.bind.address=vmtestjboss -Djboss.bind.address.management=vmtestjboss -Djboss.node.name=node2 -Djboss.socket.binding.port-offset=2\n<\/pre>\n<p>Where:<br \/>\n-c : is for server configuration file to be used, it could be &#8211;server-config<br \/>\n-Djboss.bind.address and -Djboss.bind.address.management : are for binding address<br \/>\n-Djboss.server.base.dir : is for the path from where node is present<br \/>\n-Djboss.node.name : is the name of the node &#8211; should be different for both nodes<br \/>\n-Djboss.socket.binding.port-offset : is for the port offset foe each node, it should be different for both nodes because they are running on the same host.<\/p>\n<p>We keep the default value of jboss.default.multicast.address (230.0.0.4), change it if you want to have multiple clusters on the same network.<\/p>\n<p>Once both nodes come up properly you would not see in the log any information saying that they are in a cluster until you deploy a clustered application, but what is a clustered application?<br \/>\nIn fact, to take advantage of the high availability features of clustered JBoss instances, an application first has to be marked as being distributable. To do so, include the <em>distributable<\/em>tag in the web.xml, as shown below:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;?xml version=&quot;1.0&quot;?&gt;\n    &lt;web-app ...&gt;\n        &lt;distributable\/&gt;\n    &lt;\/web-app&gt;\n...\n<\/pre>\n<p>To deploy the application on both instances, use the Command Line Interface (CLI):<br \/>\nFor node 1:<br \/>\nUse the port 9991, which is = DEFAULT MANAGEMENT HTTP PORT (9990) + PORT OFFSET (1).<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[jboss@vmtestjboss ~]$ \/opt\/install\/jboss-eap-7\/bin\/jboss-cli.sh -c --controller=vmtestjboss:9991\n[standalone@vmtestjboss:9991 \/] deploy \/opt\/install2\/cluster.war\n<\/pre>\n<p>Then check the log and notice the below line:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n20:48:59,638 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (MSC service thread 1-2) ISPN000094: Received new cluster view for channel server: [node1|0] (1) [node1]\n<\/pre>\n<p>For node 2:<br \/>\nUse the port 9992, which is = DEFAULT MANAGEMENT HTTP PORT (9990) + PORT OFFSET (2).<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n[jboss@vmtestjboss ~]$ \/opt\/install\/jboss-eap-7\/bin\/jboss-cli.sh -c --controller=vmtestjboss:9992\n[standalone@vmtestjboss:9992 \/] deploy \/opt\/install2\/cluster.war\n<\/pre>\n<p>Then check the log and notice the below line:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n20:49:59,524 INFO  [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (MSC service thread 1-2) ISPN000094: Received new cluster view for channel ejb: [node1|1] (2) [node1, node2]\n<\/pre>\n<p>The application deployed is clustered now.<\/p>\n<h1>Scenario 2: Two Standalone instances on two VMs <\/h1>\n<p>Here I have two VMs (vmtestjboss01 and vmtestjboss02), when JBoss EAP 7 is installed on both VMs, create just a single copies of standalone folder in respective VMs then start the instance:<br \/>\n&#8211; On vmtestjboss01:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\ncp -rp \/opt\/install\/jboss-eap-7\/standalone \/opt\/install\/node1\n\n\/opt\/install\/jboss-eap-7\/bin\/standalone.sh -c standalone-ha.xml -Djboss.server.base.dir=\/opt\/install\/node1 -Djboss.bind.address=vmtestjboss01 -Djboss.bind.address.management=vmtestjboss01 -Djboss.node.name=node1 -Djboss.default.multicast.address=230.0.0.5\n<\/pre>\n<p>&#8211; On vmtestjboss02:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\ncp -rp \/opt\/install\/jboss-eap-7\/standalone \/opt\/install\/node2\n\n\/opt\/install\/jboss-eap-7\/bin\/standalone.sh -c standalone-ha.xml -Djboss.server.base.dir=\/opt\/install\/node2 -Djboss.bind.address=vmtestjboss02 -Djboss.bind.address.management=vmtestjboss02 -Djboss.node.name=node2 -Djboss.default.multicast.address=230.0.0.5\n<\/pre>\n<p>-Djboss.socket.binding.port-offset is not needed here because we are working on two VMs, so we will not have port conflict.<br \/>\n-Djboss.default.multicast.address is specified here because I want to isolate this cluster from the one already configured by default (230.0.0.4)<\/p>\n<p>Deploy the clustered application as explained in the first scenario.<\/p>\n<p>When you have JBoss running on two separate machines, you will see the join indications on both machines so you know they are talking. But going to http:\/\/vmtestjboss01:8080\/cluster and http:\/\/vmtestjboss02:8080\/cluster shows no indication of session replication between the two machines. It seems like they are completely separate, whereas when you run two nodes both on the same machine it works very well. This will be explained and solved in a next blog related to session replication.<\/p>\n<p>Don&#8217;t hesitate to share your experience with JBoss clusters on standalone instances!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually, when we speak about Standalone mode we imagine that it can&#8217;t be clustered&#8230; In fact, with JBoss it is possible, the clustering functionality is configured by default in the HA-based profiles: standalone-ha.xml and standalone-full-ha.xml.<\/p>\n","protected":false},"author":46,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[38,118],"type_dbi":[],"class_list":["post-13121","post","type-post","status-publish","format-standard","hentry","category-application-integration-middleware","tag-cluster","tag-jboss"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JBoss EAP 7 - Cluster in Standalone mode - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JBoss EAP 7 - Cluster in Standalone mode\" \/>\n<meta property=\"og:description\" content=\"Usually, when we speak about Standalone mode we imagine that it can&#8217;t be clustered&#8230; In fact, with JBoss it is possible, the clustering functionality is configured by default in the HA-based profiles: standalone-ha.xml and standalone-full-ha.xml.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-03T22:43:34+00:00\" \/>\n<meta name=\"author\" content=\"David Diab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Diab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\"},\"author\":{\"name\":\"David Diab\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\"},\"headline\":\"JBoss EAP 7 &#8211; Cluster in Standalone mode\",\"datePublished\":\"2019-12-03T22:43:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\"},\"wordCount\":630,\"commentCount\":0,\"keywords\":[\"Cluster\",\"JBoss\"],\"articleSection\":[\"Application integration &amp; Middleware\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\",\"name\":\"JBoss EAP 7 - Cluster in Standalone mode - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2019-12-03T22:43:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JBoss EAP 7 &#8211; Cluster in Standalone mode\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86\",\"name\":\"David Diab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g\",\"caption\":\"David Diab\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/david-diab\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JBoss EAP 7 - Cluster in Standalone mode - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/","og_locale":"en_US","og_type":"article","og_title":"JBoss EAP 7 - Cluster in Standalone mode","og_description":"Usually, when we speak about Standalone mode we imagine that it can&#8217;t be clustered&#8230; In fact, with JBoss it is possible, the clustering functionality is configured by default in the HA-based profiles: standalone-ha.xml and standalone-full-ha.xml.","og_url":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/","og_site_name":"dbi Blog","article_published_time":"2019-12-03T22:43:34+00:00","author":"David Diab","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Diab","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/"},"author":{"name":"David Diab","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86"},"headline":"JBoss EAP 7 &#8211; Cluster in Standalone mode","datePublished":"2019-12-03T22:43:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/"},"wordCount":630,"commentCount":0,"keywords":["Cluster","JBoss"],"articleSection":["Application integration &amp; Middleware"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/","url":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/","name":"JBoss EAP 7 - Cluster in Standalone mode - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2019-12-03T22:43:34+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/jboss-eap-7-cluster-in-standalone-mode\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JBoss EAP 7 &#8211; Cluster in Standalone mode"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/deb907c3360cacdc6c7df54b4bac3c86","name":"David Diab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/212b1b2e4650bad3116f644ab4fb4663786d94195d7685d0704c8426da088e60?s=96&d=mm&r=g","caption":"David Diab"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/david-diab\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=13121"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13121\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=13121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=13121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=13121"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=13121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}