### Example 2: Setting up a JReport Server Cluster for a production environment

This example demonstrates how to set up a JReport Server Cluster on Unix/Linux by configuring the cluster UI on each JReport Server. There will be three computers in the cluster. They are node1 (IP address: 192.168.0.1), node2 (IP address: 192.168.0.2) and node3 (IP address: 192.168.0.3). All JReport Servers in the cluster use Apache Derby as the server system database.

Take the following steps to set up the cluster:

1. Make the time difference between the target computers be within one minute.
2. Install JReport Server on each of the three nodes in directories `/home/JReport/Server1`, `/home/JReport/Server2` and `/home/JReport/Server3` respectively using the appropriate license key for the cluster, and install JReport Server Monitor on one of the nodes.
3. Launch the JReport Server installed to `/home/JReport/Server1` on node1.
4. Log onto the JReport Administration page and click Cluster > Configuration on the system toolbar. In the Configuration panel, specify a cluster name and check the Enable Cluster option, then click Save to enable the cluster.
5. Restart the JReport Server on node1, and go to the JReport Administration page > Cluster > Configuration panel.
6. Leave the Load Balancer Type as Round Robin.
7. Check the Cluster Scheduler Lease option to enable scheduler leases for the cluster, then set the active count, valid time and check interval for the cluster scheduler lease respectively. The defaults of 2 active schedules with a time of 300 seconds and check interval of 30 seconds are a good starting point.
8. Keep the cluster storage history, realm and CRD result number of copies to 2. This means that each resource will be copied to 2 of the 3 servers so there will be no single point of failure for the resources.
9. Keep the default value 2 for Cluster Memory Storage Number of Copies, thus 2 memory copies will be shared in the cluster.
10. Check the Notify via E-mail When a Server Is Down option, and in the E-mail Address text field, input the e-mail addresses of the people to whom you want to send a notification e-mail.
11. Keep the default values for Properties Directory, Realm Directory, Resource Root, History Directory and Temporary Files Directory.
12. In the Server's RMI Host text field, type the IP address or host name of Server1 as 192.168.0.1. Type the port number in the Server's RMI Port text field as 1129.
13. Click Save to accept all the changes.
14. Go to the Data > System DB panel of Server1, in the Configuration tab, copy the URL in the URL text field to a temporary file, and go to the Realm DB panel to copy the URL using the same way.

    In order to use a JReport Server Cluster, all nodes in the cluster must use the same database. In this case, all three nodes will use the database Server1 uses. This ensures that all servers in the cluster share a single DBMS instance.

15. Shut down the server.
16. Launch the JReport Server installed to `/home/JReport/Server2` on node2.
17. Log onto the JReport Administration page and click Cluster > Configuration on the system toolbar. In the Configuration panel, use the same cluster name as Server1, thus making Server2 join the existing cluster. Check the Enable Cluster option, then click Save to enable the cluster.
18. Restart the JReport Server on node2. Go to the JReport Administration page > Data > System DB/Realm DB, make the system database and realm database in the URL text field the same as those of node1.
19. Go to the Cluster > Configuration panel.
20. In the Server's RMI Host text field, type the IP address or host name of Server2 as 192.168.0.2. Type the port number in the Server's RMI Port text field as 1129.
21. Click Save to accept all the changes, then shut down the server.
22. Copy rmi.auth in `/home/JReport/Server1/bin` to `/home/JReport/Server2/bin`. This allows RMI to be authorized between node1 and node2.
23. Launch the JReport Server installed to `/home/JReport/Server3` on node3. Just like what we did with node2, enable cluster and make node3 join the existing cluster too.
24. Restart the JReport Server on node3. Go to the JReport Administration page > Data > System DB/Realm DB, make the system database and realm database in the URL text field the same as those of node1.
25. Go to the Cluster > Configuration panel.
26. In the Server's RMI Host text field, type the IP address or host name of Server3 as 192.168.0.3. Type the port number in the Server's RMI Port text field as 1129.
27. Click Save to accept all the changes, then shut down the server.
28. Just as we did with node2, copy rmi.auth in `/home/JReport/Server1/bin` to `/home/JReport/Server3/bin`.
29. Start the server Derby DBMS service by running the startNetworkServer.sh file in `/home/JReport/Server1/derby/bin`.
30. Launch the server on node1. In the Command Prompt window, you will see the following information:

    `JReport Server is ready for service.`

31. Similarly, launch the server on node2 and node3.
32. Start JReport Server Monitor and go to the JReport Monitor page to track the cluster.