# Clustering configuration

The following configuration items define how Liberator participates in a cluster.

Want to know more about clustering? See here.

 "this Liberator" means the Liberator for which you are defining the configuration. "this node" means the cluster node that this Liberator represents.

`add-cluster-node` identifies a Liberator in the cluster.

 For more about how to use `add-cluster-node`, see Clustering Liberators without the Caplin Deployment Framework in How can I.. Set up a cluster of Liberators.

Syntax:

```add-cluster-node
cluster-port [integer]
end-cluster-node```
Option Type Default Description

`cluster-addr`

string

`127.0.0.1`

The network interface address or hostname of the cluster node.

In the Caplin Platform Deployment Framework, the configuration macros `LIBERATOR${THIS_LEG}_HOST` and `LIBERATOR${OTHER_LEG}_HOST` specify the `cluster-addr` values. Clustering is used in the Deployment Framework to support failover capability. You normally use the `./dfw hosts` command to set up the hostnames in the macros. See Configuring server hostnames in How can I…​ Set up server failover capability, and Change server hostnames in How can I …​ Change server-specific configuration.

Also see Deployment Framework Configuration macros and items.

`cluster-port`

integer

`2333`

The network port number of the cluster node. This port is used for cluster-related communication between the Liberator and the other Liberators in the cluster.

In the Caplin Platform Deployment Framework, the configuration macros `LIBERATOR${THIS_LEG}_CLUSTER_PORT` and `LIBERATOR${OTHER_LEG}_CLUSTER_PORT` specify the `cluster-port` values. See Clustering Liberators in the Caplin Deployment Framework in How can I …​ Set up a cluster of Liberators.

Also see Deployment Framework Configuration macros and items.

## cluster-heartbeat-slack-time

`cluster-heartbeat-slack-time` When this Liberator doesn’t receive an expected cluster heartbeat (see cluster-heartbeat-time) from another Liberator in the cluster, it waits `cluster-heartbeat-slack-time` seconds before disconnecting from the cluster and trying to reconnect to it.

Unlike `cluster-heartbeat-time`, the value of `cluster-heartbeat-slack-time` is not compared by the Liberators in the cluster.

Syntax: `cluster-heartbeat-slack-time <slack-time-in-seconds>`

Type: integer

Default value: `5` seconds

## cluster-heartbeat-time

`cluster-heartbeat-time` specifies the time in seconds between each cluster heartbeat. The Liberators forming a cluster exchange heartbeat messages at regular intervals, allowing each of them to check that all the others are still present. If the cluster heartbeat times out, this Liberator waits cluster-heartbeat-slack-time and then disconnects from the cluster and tries to reconnect to it.

When all the Liberators in the cluster have initially connected, they compare their `cluster-heartbeat-time` values and use the lowest.

 In the Caplin Platform Deployment Framework, you use a configuration macro `LIBERATOR_CLUSTER_HEARTBEAT_TIME` to specify Liberator’s `cluster-heartbeat-time`. See Clustering Liberators in the Caplin Deployment Framework in How can I …​ Set up a cluster of Liberators, and Deployment Framework Configuration macros and items.

Syntax: `cluster-heartbeat-time <heartbeat-time-in-seconds>`

Type: integer

Default value: `15` seconds

The minimum allowed value is 1 second.

## cluster-index

`cluster-index` specifies the index number of this cluster node. The index number uniquely identifies this Liberator within the cluster. It states which of the add-cluster-node items this node represents. Index numbers start at 0 and correspond to the order of the add-cluster-node items in the configuration file.

 In the Caplin Platform Deployment Framework, you use a configuration macro `LIBERATOR_CLUSTER_NODE_INDEX` to specify Liberator’s `cluster-index`. See Clustering Liberators in the Caplin Deployment Framework in How can I …​ Set up a cluster of Liberators, and Deployment Framework Configuration macros and items.

Syntax: `cluster-index <index-number>`

Type: integer

Default value: `0`

## cluster-packet-logfile

`cluster-packet-logfile` specifies the name of the log file in which message packets passed between this Liberator and other nodes in the Liberator cluster are recorded.

The filename can contain the parameter `%a`, which is replaced at run-time by this Liberator’s DataSource `application-name`. The log file is located in Liberator’s `var` directory (the `<Framework-root>/servers/Liberator/var` directory in the Deployment Framework).

The log file’s format is the same binary format used for the standard DataSource packet log (see `datasrc-pkt-log` in DataSource peers configuration part 2), so you need to use the logcat utility to read it.

 Only configure `cluster-packet-logfile` when you need to troubleshoot your Liberator cluster. Cluster packet logs can quite quickly become very large, so you should only enable logging of this information for debugging purposes.

Syntax: `cluster-packet-logfile <log-file-name>`

Type: string

Default value: (none, but this configuration item is optional - if it’s not present then cluster packets aren’t logged)