## Appendix 3: System database properties in JReport Server Cluster

This appendix provides a list of properties stored in the server's system database which is created when a JReport clustered server is started, and the detailed information about these properties.

Property Name | Default Value (Range) | Description
--- | --- | ---
CLUSTER
cluster.enable_notify_server_down | false | Specifies whether to notify somebody via e-mail when a server in the cluster is down. The e-mail address is specified by the cluster.notify_server_down_address property.
cluster.notify_server_down_address | - | Specifies the e-mail addresses of the people to whom you want to send a notification e-mail when a server in the cluster is down. This property takes effect only when the cluster.enable_notify_server_down property holds a true value.
cluster.scheduler.lease.active_count | 2 | Specifies the active lease number in a cluster. The property value should be an integer.
cluster.scheduler.lease.check_interval | 30 | Specifies the time interval the cluster will use to check the number of active leases. The property value should be an integer in seconds.
cluster.scheduler.lease.enabled | false | Specifies whether to enable lease for a distributed scheduler in the cluster. If a distributed scheduler is enabled with lease, it becomes an active scheduler and will compete to trigger the schedule.
cluster.scheduler.lease.valid_time | 300 | Specifies the period of time that the clustered server can hold a lease before releasing it. The property value should be an integer in seconds.
cluster.share_memory.node_number | 2 | Specifies how many memory copies will be shared in a cluster. The property value should be a positive integer.
cluster.storage.crd_result.copy_number | 2 | Specifies how many copies will be made in a cluster when a new file or folder is added to the cached report data (CRD) result folder. The property value should be an integer.
cluster.storage.history.copy_number | 2 | Specifies how many copies will be made in a cluster when a new file or folder is added to the history folder. The property value should be an integer.
cluster.storage.realm.copy_number | 2 | Specifies how many copies will be made in a cluster when a new file or folder is added to the realm folder. The property value should be an integer.
LOADBALANCE
loadbalance.type | 1 (0 ~ 3) | Specifies the load-balance type. 0 - Uses Least Current Reports Algorithm to allocate tasks. 1 - Uses Round Robin Algorithm to allocate tasks. 2 - Uses Least Weighted Current Reports Algorithm to allocate tasks. 3 - Randomly allocates tasks. See Built-in load balancing algorithm for details about the four load balancing types.
loadbalance.custom_class | - | Specifies the class name of user's load balancer.
SERVER
server.autocache.enabled | false | Specifies whether to enable to automatically cache report data. For more about cached report data, see Managing cached report data.
server.autocache.expired.time | 0 | Specifies the period an automatic cached data result is kept. This property takes effect when `server.autocache.enabled=true` and `server.autocache.never.expire=false.`
server.autocache.max.disk.usage | 512 | Specifies the maximum hard disk space for automatic cached data. The value should be between 4 MB and 1024*1024 MB. This property takes effect when server.autocache.enabled=true.
server.autocache.never.expire | true | Specifies whether automatic cached data never expires. This property takes effect when `server.autocache.enabled=true`.
server.completed.max_count | 3000 (0 ~ 2147483647) | Specifies the maximum number of completed records that will be kept the Completed table. Set the value to zero if you do not want to limit the record count.
server.crd.memory.usage | 4 | Specifies the maximum memory usage when running a report using cached report data. The minimum value is 4 MB and can be increased up to 80% of the total Java maximum heap size (for example, -Xmx value in JRServer.bat). All cached report data being used to run reports will share the same memory space. For more about cached report data, see Managing cached report data.
server.realm.active | defaultRealm | Specifies the realm that takes effect when the server starts up. The specified realm should exist, otherwise the server will use an existing realm as active realm. The server will then record a warning message in the log file, and set the selected active realm by this property in the server.properties file.
server.security | true | Specifies whether to enable security checking on remote requests. When it is set to false, responses will be made without any security checking. This does not apply to Remote Configuration and Administration.
server.version.from.temp | false | Specifies to enable the "Publish to Version System" option when previewing a report result. This property functions the same as the Enable "Publish to Versioning System" for Background Tasks View option in the Configuration > Advanced panel of the JReport Administration page. If the value is set to true, a link Publish to Versioning System will be added to the upper-left corner of the report preview page (preview a report result using the Run command). Click the link to publish the result to version in the current format.

Properties in the following configuration files are also stored in the server's system database when a JReport clustered server is started:

File Name | Description | Mapped Server UI
--- | --- | ---
mailconfig.properties | Configuration for sending e-mails | JReport Administration page > Configuration > Export > E-mail
clusterWeight.properties | Configuration for performance weight in a cluster | JReport Administration page > Cluster > Weight
LDAPProperties.xml | Configuration for LDAP support | JReport Administration page > Configuration > LDAP > Server

### Setting properties by using API

For the cluster properties that are stored in the server's system database, except for loadbalance.custom_class and server.completed.max_count, all the others can be set on the JReport Administration UI. The following demo API code shows you how to set these two properties:

    import jet.server.api.admin.ClusterAdminService;
    import jet.server.api.admin.cfg.ConfigurationAdvanced;
    import jet.server.api.cluster.LoadBalancer;
    import jet.server.api.cluster.Member;
    import jet.server.api.http.HttpRptServer;
    import jet.server.api.http.HttpUtil;

    public class APIDemo {

        public static void main(String[] args) {

            // Sets report home "C:\\JReport\\Server"
            System.getProperties().put("reporthome", "C:\\JReport\\Server\\");

            // Creates instance of RptServer.
            HttpUtil.initEnv(System.getProperties());
            HttpRptServer httpRptServer = HttpUtil.getHttpRptServer();
            System.out.println(" ========httpRptServer= " + httpRptServer);

            ConfigurationAdvanced configAdvanced = httpRptServer.getAdminService()
                         .getConfigService().getConfigurationAdvanced();
            //Gets the maximum number of completed records that will be kept in the Completed table.
            //Value 0 means the record number is unlimited.
            int compledRecordCount = configAdvanced.getMaxCompletedRecordCount();
            //Sets the maximum number of completed records that will be kept in the Completed table.
            configAdvanced.setMaxCompletedRecordCount(50);

            ClusterAdminService adminService = httpRptServer.getAdminService().getClusterAdminService();
            //Loads balance class
            System.out.println("load balance class" + adminService.getLoadBalanceCustomClass());
            //Sets load balance, there should be APILocalBalancer which implements interface LoadBalancer;
            adminService.setLoadBalanceCustomClass("APILocalBalancer");
        }
    }