Infinispan

The clustering in WildFly 10 is managed by Infinispan 8.2.4. This project was born in the JBoss community; when it started, it was called JBoss Cache. JBoss Cache/Infinispan has been the cluster library of the JBoss application server since the JBoss 4.x version.

Infinispan is a distributed cache project. It is based on an internal memory in which we can put some kind of data so that it can be distributed in a wide net of nodes where Infinispan is installed and configured.

By default, Infinispan connects all nodes in the same subnet in one group of data. The same achievement happens in WildFly. As an example, we can try to start WildFly 10 in different nodes using the standalone.sh command, deploy a web application, and monitor what happens.

The standalone.sh file in the bin directory of WildFly allows us to choose a starting configuration. We will start an initial WildFly instance with the ./standalone -c standalone-ha.xml command.

standalone-ha.xml is the configuration file containing a default configuration of the cluster. HA is for high availability; it's the condition the cluster has to guarantee.

The second instance of WildFly can be started on a different machine inside the same subnet with the same command. Alternatively, for those who cannot use multiple machines, often when running application tests, you can launch a second WildFly instance on the same machine as the first by adding the following argument to the launch script:

-Djboss.socket.binding.port-offset=1000 

This property allows a WildFly instance to start with a configured subset of ports. Changing the subset of ports allows us to start different instances of WildFly on the same machine because we will avoid the conflicts with the ports that WildFly has to open before starting.

The number 1000 says that the subset of ports must be 1000 more than the default. For example, if the default web port is 8080, WildFly will start the web connector using the port number 8080 + 1000, becoming 9080. Now, we have started two WildFly instances, and we need to deploy a web application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.75.227