The app server usually manages the user session for a web application and is responsible for the policies that allow the session to be replicated in a cluster environment. However, you must also configure parts of JasperReports Server for repository and session replication, including the Ehcache component.
| This section describes how to configure JasperReports Server for session replication. To configure your application server, see the documentation for your application server. For additional information, see the section "Configuration for Session Persistence" in the TIBCO JasperReports Server Administrator Guide. |
This section describes two levels of replication for JasperReports Server:
| • | Ehcache replication only. The repository cache handles the folder structure and saved reports, and speeds up repository access in a given instance of JasperReports Server. Changes to permissions and folders are cached on the server where they occur, but they can take one to two minutes to be written to the repository database. To maintain performance and avoid collisions, you should configure Ehcache replication whenever you have multiple JasperReports Server instances that share a single repository. Ehchache replication can be configured independently of session replication. |
| • | Partial session replication for failover. Partial session replication shares, based on Ehcache replication, shares additional information about the logged-in users and allows for failover without requiring re-authentication. If you configure this, you must first configure Ehcache replication. |
EhCache Replication
The repository cache in JasperReports Server is implemented internally via the Ehcache component. Edit the Ehcache configuration files as described below to replicate the repository cache among all instances that share a single repository. You do not have to configure a cluster for cache replication.
There are several replication mechanisms available:
| • | RMI – Remote Method Invocation is the simplest and fastest cache distribution mechanism. Use RMI distribution if your cluster runs on your own real or virtual computers, as long as their addresses will not change. You cannot use RMI distribution if your cluster is hosted in a cloud, such as with Amazon Redshift, because the IP addresses of the nodes may change. RMI distribution relies on IP multicast, which you must set up. |
| • | JMS – Java Message Services can provide cache distribution for nodes in a cloud where IP addresses may change. Jaspersoft provides a configuration for using the Apache ActiveMQ JMS Server. You must first install and configure ActiveMQ on one of the computers in your cluster. |
| • | Amazon SNS/SQS – Simple Notification Service and Simple Queue Service can provide cache distribution for nodes in Amazon Web Services (AWS). Using this option may incur additional costs as Amazon charges customers per API call. Before you can use SNS, you must create an SNS topic from your AWS Console. Amazon SNS/SQS support is experimental; the ActiveMQ JMS option also works for AWS and is the preferred method for Ehcache distribution. |
On each node, you must edit the following cache configuration files. Make sure to uncomment only one of the options provided in each file:
| • | Ehcache for Hibernate: Edit the following file as described below. |
| • | /WEB-INF/classes/ehcache_hibernate.xml. (Once the file is fully configured, you will also copy it to /WEB-INF/ehcache_hibernate.xml.) |
| • | Ehcache: Edit the following file as described below. |
| • | <web-app>/WEB-INF/ehcache.xml |
To configure JasperReports Server nodes for repository cache replication:
| 1. | If you are using RMI distribution, you must make sure that the subnet that contains all the nodes is configured to allow IP multicasting. |
| 2. | For all distribution mechanisms, comment out the section marked "NO CLUSTERING" in both files as follows. By default, this section is uncommented. For example, in the ehcache_hibernate.xml, comment out the "NO CLUSTERING" section as follows: |
| 3. | (RMI only) To configure the nodes for RMI distribution: |
| a. | Uncomment the RMI section in <web-app>/WEB-INF/classes/ehcache_hibernate.xml and <web-app>/WEB-INF/ehcache.xml on each node. |
| b. | Set the RMI properties for your IP multicast. |
| c. | Configure CacheManagerPeerListenerFactory with different ports in <web-app>/WEB-INF/classes/ehcache_hibernate.xml and <web-app>/WEB-INF/ehcache.xml. The port should be the same across all nodes. For example, you might set the port property as follows: |
| • | port=40001 in <web-app>/WEB-INF/classes/ehcache_hibernate.xml on all nodes |
| • | port=40011 in <web-app>/WEB-INF/ehcache.xml on all nodes |
| d. | You must also add the hostname property with the value of the real IP address, in this example, 123.45.6.701. Add the hostName property to the cacheManagerPeerListenerFactory, right before the port. This specifies the real IP address of the host, as shown in the example above. |
The following example shows the beginning of the RMI section of one of the files:
| 4. | (JMS only) For JMS distribution: |
| a. | Install the JMS server on one computer in your cluster. |
| b. | Uncomment the JMS section in <web-app>/WEB-INF/classes/ehcache_hibernate.xml and <web-app>/WEB-INF/ehcache.xml on each node. |
| c. | Set the providerURL properties in both files to the address of your JMS server, for example 123.45.6.701. There are several providerURL properties to set in each file, only the first one is shown in the code example below. |
| d. | If you do not use the default values for replicationTopicBindingName and topicBindingName, make sure that these names are different for the two different files. |
For example, you might set these properties as follows:
| • | myName1 in <web-app>/WEB-INF/classes/ehcache_hibernate.xml on all nodes. |
| • | myName2 in <web-app>/WEB-INF/ehcache.xml on all nodes. |
| 5. | (Amazon SNS/SQS only) For Amazon SNS/SQS: |
| | e. | Using Amazon SNS/SQS may incur additional costs as Amazon charges customers per API call. Amazon SNS/SQS support is experimental; the ActiveMQ JMS distribution also works for AWS and is the preferred method for Ehcache distribution. | |
| a. | Before using SNS, create an SNS topic from your AWS Console. |
| b. | Edit the <web-app>/META-INF/classes/aws.properties file on every node to specify your AWS credentials, SNS topic (same for every node), SQS queue (unique per cluster) and node id (unique per cluster). You can also specify the desired number of queue reading threads (10 is recommended). |
aws.accessKey=AKILRCPWVYTY3MPDPS6Aaws.secretKey=tSlV/scTtHUfe6JggTO56lkeZFb+0DEBDyUWuQMeaws.queuesuffix=_aws3aws.topicsuffix=_aws3aws.nevadoTopicName=ehcacheJMSTopicaws.nevadoQueueName=ehcacheAWS3aws.clientID=AWS3Serveraws.threadCount=10[/code] |
| c. | Uncomment the AWS section in <web-app>/WEB-INF/classes/ehcache_hibernate.xml and <web-app>/WEB-INF/ehcache.xml on every node. |
| 6. | On each node, edit the file <web-app>/META-INF/context.xml. Locate the Manager pathname near the end, and comment it out as follows: |
| 7. | Copy the correctly configured <web-app>/WEB-INF/classes/ehcache_hibernate.xml file to <web-app>/WEB-INF/ehcache_hibernate.xml on each node. |
| 8. | If you are only configuring cache replication, restart or redeploy JasperReports Server on each node. If you also want partial session replication, complete the additional configurations below before restarting. |
Additional Configurations for Partial Session Replication
If you want to configure partial session replication/failover, first set up repository cache replication as described in EhCache Replication, then make the additional changes described in this section.
On each node, edit all of the following three files as described below for your chosen distribution mechanism. You should make the same additional changes in all of them. Make sure to uncomment only one of the options provided in each file:
| • | <web-app>/WEB-INF/ehcache_hibernate.xml |
| • | <web-app>/WEB-INF/classes/ehcache_hibernate.xml |
| • | <web-app>/WEB-INF/ehcache.xml |
| Partial session replication, which is based on UDP (User Datagram Protocol), is not available for Amazon Web Services. |
To configure JasperReports Server nodes for partial session replication:
| 1. | Make sure that the subnet that contains all the cluster nodes is configured to allow IP multicasting. This is usually required by the app server for replication, and it's also required by JasperReports Server's Ehcache component when using RMI distribution in a cluster environment. |
| 2. | On each node of the cluster, edit the file <web-app>/WEB-INF/web.xml to make the following changes: |
| a. | Locate the ClusterFilter that's given in comments and uncomment it as follows: |
| b. | Locate the corresponding mapping for the ClusterFilter and uncomment it as well. You must also uncomment the <distributable> element. |
| 3. | On each node of the cluster, enable session replication in your app server or web container. For example, to enable session replication on Apache Tomcat 9.x, edit the file <tomcat>/conf/server.xml as follows. |
Add the Cluster definition within the <Engine name="Catalina" defaultHost="localhost"> configuration. In this example, 123.45.6.701 is the IP address of the node being configured. This example uses Delta Manager, but you can also use Backup Manager:
| 4. | Restart or redeploy JasperReports Server on each node. |
Recommended Comments
There are no comments to display.