Skip to content

Configuring High Availability (HA)

Last update January 20, 2017

The following configuration steps to be performed to enable HA.

High Availability

High Availability (HA) is the ability for the system to continue functioning after failure of one or more of the servers. A part of High Availability is failover which is defined as the ability for user connections to migrate from one server to another if there is a server failure the user applications can continue to operate. Enabling High Availability (HA) helps achieve load balancing, failover, and scalability features.CA Business Intelligence JasperReports® Server JaspersoftReports Server uses HTTP Server, as a result the failover occurs for e-node and the load balancer or router is appropriate for HTTP Server-based application. 

Configuring High Availability Environment

CA Business Intelligence JasperReports® Server supports only Tomcat as its application server, <web-app> usually refers to jasperserver-pro 

Prerequisites:

Install CA Business Intelligence JasperReports® Server JaspersoftReports Server 6.3.0 on one machine using a remote database. 

To configure a High Availability Environment:

For a full HA environment, set the database to the HA mode. 

Once installation is complete, perform the following steps:

  1. To make changes, edit the file: 

    <web-app>/WEB-INF/web.xml

  2. Locate the listener of class RequestContextListener and replace it with the listener of class TolerantRequestContextListener. The new listener class is given in the comments that you have to uncomment as shown:

    <!--Replace the default spring listener with the Tolerant listener to enable replication–>
    <listener-class>com.jaspersoft.jasperserver.core.util.TolerantRequestContextListener</listener-class>
    <!--listener-class>org.springframework.web.context.request.RequestContextListener</listener-class–>

  3. Locate the ClusterFilter that is given in comments and uncomment it as follows:

    <filter>
        <filter-name>ClusterFilter</filter-name>
        <filter-class>com.jaspersoft.jasperserver.war.TolerantSessionFilter</filter-class>
    </filter>

  4. Locate the corresponding mapping for the ClusterFilter and uncomment it. Uncomment the <distributable> element too.

    <filter-mapping>
        <filter-name>ClusterFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <distributable/>

  5. Edit the <web-app>/WEB-INF/ehcache.xml file to uncomment the following section:

    <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, replicatePuts=false, 

    replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true"/> <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>

  6. Edit the <web-app>/WEB-INF/ehcache_hibernate.xml file as described to comment the section marked "NO CLUSTERING": 

    <!-- ********************* NO CLUSTERING ******************** -->
    <!-- START <cache name="defaultRepoCache" maxElementsInMemory="10000" eternal="false" overflowToDisk="false" timeToIdleSeconds="36000" timeToLiveSeconds="180000" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" statistics="true">
    </cache>
        <cache name="aclCache" maxElementsInMemory="10000" eternal="false" overflowToDisk="false" timeToIdleSeconds="360000" timeToLiveSeconds="720000" diskPersistent="false"
    </cache> 
    END -->
    <!-- ******************* END of NO CLUSTERING ******************* -->

  7.  Uncomment the RMI section from Start tag to End tag, and ensure that the properties are correct for your IP multicast.

    <!-- ************************** RMI ************************* -->
    <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=automatic,multicastGroupAddress=228.0.0.1, t=4446,timeToLive=1"/> <cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40011,remoteObjectPort=40012,socketTimeoutMillis=120000"/>
     ... 
    <!-- *********************** END of RMI *********************** -->

  8. Edit the <web-app>/META-INF/context.xml file. Locate the Manager pathname near the end, and comment it out as follows:

    <!-- <Manager pathname="" /> -->

  9. To enable session replication in Apache Tomcat 7.x and Tomcat 8.x, edit the <tomcat>/conf/server.xml file. 

  10. Add an attribute jvmRoute="node1" to <Engine name="Catalina" defaultHost="localhost"> tag and the Cluster definition within it as shown in the example.(This is an example that uses Delta Manager, but you can also use Backup Manager).

    Tomcat 7

    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">

    <Manager className="org.apache.catalina.ha.session.DeltaManager"
    expireSessionsOnShutdown="false"
    notifyListenersOnReplication="true"/>
    <Channel className="org.apache.catalina.tribes.group.GroupChannel">

    <Membership
    className="org.apache.catalina.tribes.membership.McastService"
    address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/>
    <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
    <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
    </Sender>

    <Receiver
    className="org.apache.catalina.tribes.transport.nio.NioReceiver"
    address="auto" port="4000" autoBind="100" selectorTimeout="5000"
    maxThreads="6"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
    </Channel>
    <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
    <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
    <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
    <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>

    Tomcat 8

    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
    channelSendOptions="8">
    <Manager className="org.apache.catalina.ha.session.DeltaManager"
    expireSessionsOnShutdown="false"
    notifyListenersOnReplication="true"/>
    <Channel className="org.apache.catalina.tribes.group.GroupChannel">
    <Membership className="org.apache.catalina.tribes.membership.McastService"
    address="228.0.0.4"
    port="45564"
    frequency="500"
    dropTime="3000"/>
    <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
    address="auto"
    port="4000"
    autoBind="100"
    selectorTimeout="5000"
    maxThreads="6"/>
    <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
    <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
    </Sender>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
    </Channel>
    <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
    filter=""/>
    <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
    <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>

  11. At this time, zip the entire Tomcat folder or only <web-app> folder if you want to use different versions of Tomcat in other nodes. If you want to add any node to this cluster at any time, then on that node install JDK (supported version by both CABI and Tomcat) and/or tomcat depending on what you zipped in previous step. If you zipped the entire Tomcat folder and extracted it in the new node the edit server.xml to reflect the new node's jvmRoute value as node2. If you zipped only the <web-app> folder, then configure server.xml similar to Step 5.

    Ensure that you have different jvmRoute values for all nodes in the cluster.

  12. Copy the .jrsks,.jrslic,.jrsksp files from the node1's system current user directory to the node2's system user directory

Load Balancer

The load balancer exists between the user and two (or more) back-end Apache web servers that hold the same content. Not only does the load balancer distribute the requests to the two back-end Apache servers, it also checks the health of the back-end servers. If one of them is down, all requests are automatically be redirected to the remaining back-end server.

Configuring Apache Web Server as a Load Balancer Server

To use Apache web server (httpd) as load balancing server, and also as the interface to the clients:

  1. Install httpd and copy the appropriate mod_jk.so file to the modules folder.
  2. Create workers.properties file in conf folder with the following content:

    worker.list=loadbalancer,status 
    worker.node1.port=8009 
    worker.node1.host=node1's server name/ip address
    worker.node1.type=ajp13
    worker.node1.lbfactor=1 
    worker.node2.port=8009 
    worker.node2.host=node2's server name/ip address 
    worker.node2.type=ajp13 
    worker.node2.lbfactor=1 
    worker.loadbalancer.type=lb 
    worker.loadbalancer.balance_workers=node1,node2 
    worker.loadbalancer.sticky_session=1 
    worker.status.type=status

  3. Create mod-jk.conf file in <apache web server (httpd) directory>/conf folder with the following content:

    LoadModule jk_module modules/mod_jk.so 
    JkWorkersFile conf/workers.properties 
    JkLogFile logs/mod_jk.log 
    JkLogLevel info 
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" 
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories 
    JkRequestLogFormat "%w %V %T" 
    JkMount /* loadbalancer 
    JkShmFile logs/jk.shm 
    <Location /jkstatus> 
    JkMount status 
    Order deny,allow 
    Allow from all 
    </Location>

  4. At the end of the conf/httpd.conf file, add the following:

    Include conf/mod-jk.conf

  5. Start the httpd server and Tomcat servers on all nodes. 

    When you add any new nodes to this cluster in future only then the modification in this load balancing server that is updated to workers.properties to reflect the information of the new node.

Was this helpful?

Please log in to post comments.

  1. Mallikarjuna Reddy Nune
    2017-01-11 07:16

    From the ehcache_hibernate.xml i see we have to comment this NO CLUSTERING as per document it says to uncomment, plz clarify step 6 Edit the /WEB-INF/ehcache_hibernate.xml file as described to uncomment the section marked "NO CLUSTERING"

    we need to comment this section, please confirm.

    Regards, Mallikarjuna

    1. Sarah Gideon
      2017-01-12 05:25

      Hi Sarath Kumar Mitta,

      Can you please comment on this. 

      Thank you.