> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/getting-started/configuration/cluster.md). Agents can also search and read this documentation through its [MCP server](https://boxlang.ortusbooks.com/~gitbook/mcp).

# Cluster

Configure BoxLang cluster coordination through a shared cache

{% hint style="success" %}
New in BoxLang **1.20.0**.
{% endhint %}

The `cluster` section of `boxlang.json` lets a BoxLang node coordinate with other nodes through a shared cache. Clustered [scheduled tasks](https://boxlang.ortusbooks.com/boxlang-framework/asynchronous-programming/clustered-scheduled-tasks.md) are the first feature built on it. They run once per occurrence across the fleet instead of once per node, and the work is shared out.

## Configuration Structure

```json
{
  "cluster": {
    "enabled": false,
    "nodeId": null,
    "name": "default",
    "cacheName": "bxcluster",
    "heartbeatSeconds": 5
  }
}
```

## Configuration Properties

### enabled

**Type:** `boolean` **Default:** `false` **Description:** The master switch for this node. When `false`, nothing else in this section is used, and a task marked as clustered refuses to start.

### nodeId

**Type:** `string` **Default:** `null` **Description:** This node's identity. When `null`, BoxLang uses `{hostname}-{pid}`, which is unique per process. Set it when your platform gives you a stable pod or task name.

```json
"nodeId": "${HOSTNAME}"
```

### name

**Type:** `string` **Default:** `"default"` **Description:** The cluster name. Nodes with the same name see each other and share work. Different names never do, so one shared cache can serve several independent clusters.

### cacheName

**Type:** `string` **Default:** `"bxcluster"` **Description:** The cache used for coordination. It must be backed by a store every node can see, such as a distributed provider like Redis, a JDBC store, or a `FileSystemStore` on a shared volume.

```json
{
  "cluster": { "enabled": true, "cacheName": "bxcluster" },
  "caches": {
    "bxcluster": {
      "provider": "Redis",
      "properties": { "host": "redis.internal.example.com", "port": "6379" }
    }
  }
}
```

{% hint style="warning" %}
The bundled `default` cache is local to each JVM. Nodes sharing it never see each other.
{% endhint %}

### heartbeatSeconds

**Type:** `integer` **Default:** `5` **Description:** How often this node rewrites its record in the shared cache. A node is considered gone after three missed beats. The value must be greater than zero.

## Related Scheduler Settings

How occurrences are shared out is a scheduler policy, so it lives in the [`scheduler`](https://boxlang.ortusbooks.com/getting-started/configuration/scheduler.md) section: `clusterMode`, `clusterTasks` (whether tasks cluster by default), `taskOverlapPolicy`, `shutdownGraceSeconds` and `shutdownInterruptGraceSeconds`.

## Related Configuration

* [BoxLang Clustering Services](https://boxlang.ortusbooks.com/boxlang-framework/clustering-services.md)
* [Clustered Scheduled Tasks](https://boxlang.ortusbooks.com/boxlang-framework/asynchronous-programming/clustered-scheduled-tasks.md)
* [Scheduler](https://boxlang.ortusbooks.com/getting-started/configuration/scheduler.md)
* [Caches](https://boxlang.ortusbooks.com/getting-started/configuration/caches.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/getting-started/configuration/cluster.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
