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

This example demonstrates how to configure a JReport Enterprise Server cluster by modifying the server.properties file on each JReport Enterprise Server. There will be three computers in the cluster. They are node0, node1 (IP address: 127.0.0.1) and node2 (IP address: 127.0.0.2). All JReport Enterprise Server in the cluster use HSQLDB as the server system database.

Take the following steps to set up the cluster:

1. Configure the shared directory on node0. Share a folder on the node0 computer so that it can be accessed by the network computers. On node1 and node2, select drive letter K to map to the shared directory.
2. Configure node1 to run as the admin server.

   Install JReport Enterprise Server to `C:\JReport\Serveradmin` on node1. Launch JReport Enterprise Server on node1 and then shut it down. Open the server.properties file in `C:\JReport\Serveradmin\bin`, and modify it as below:

   `cluster.server.backup=false
   cluster.server.admin=true
   server.rmi.port=1129`

   Add the following properties:

   `loadbalance.type=1
   resource.share.temp.dir=K:\temp
   resource.share.hist.dir=K:\history
   resource.share.realm.dir=K:\realm
   resource.share.properties.dir=K:\properties
   resource.root=K:\jreports`

   Then edit dbconfig.xml in `<install_root>\bin` by making the system database be in the shared properties directory `K:\properties` as set above.

3. Configure node2 to run as a backup server.

   Install JReport Enterprise Server to `C:\JReport\Serverbackup` on node2. Launch JReport Enterprise Server on node2 and then shut it down. Open the server.properties file in `C:\JReport\Serverbackup\bin`, and modify it as follows:

   `cluster.server.backup=true
   cluster.server.admin=false
   cluster.admin.rmi.port=1129
   server.rmi.port=1130`

   Add the following properties:

   `loadbalance.type=1
   resource.share.temp.dir=K:\temp
   resource.share.hist.dir=K:\history
   resource.share.realm.dir=K:\realm
   resource.share.properties.dir=K:\properties
   resource.root=K:\jreports`

   Then edit dbconfig.xml in `<install_root>\bin` by making the system database be in the shared properties directory `K:\properties` as set above.

4. Copy the five folders (temp, history, realm, properties and jreports) in `C:\JReport\Serveradmin` on node1 to the network drive K. Empty the other four folders while keeping the jreports folder intact, since the resources in this folder will be used in the following steps.
5. Launch the admin server on node1. In the Command Prompt window, you will see the following information:

   `JReport Enterprise Server is ready for service.`

   Launch the backup server on node2. In the Command Prompt window, you will see the following information:

   `Connecting to admin server [127.0.0.1:1129].
   Connected to admin server [127.0.0.1:1129] successfully.`

   This means that the cluster has been configured and launched successfully.

6. Log onto the JReport Administration page on the admin server on node1, click Cluster on the system toolbar, click the Config tab, and then click Add Server. Provide the following server information:
   - Server Name: B1 (The server name can be any string you prefer. It does not need to be the computer network ID.)
   - Host Address: 127.0.0.2 (The IP address of the backup server).
   - RMI Port: 1130
   - Backup Priority: 1 (The backup priority can be any integer. However, it must be unique among the backup servers. A slave server does not require this property to be set).

   Only after a server has been added to the predefined server list, can it be tracked and monitored by the JReport Server Monitor.