> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorose.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Distributed Deployment

> Raft-backed clustering, local cluster setup, and cluster management.

# Distributed Deployment

Memorose supports replicated deployment with Raft and can be started locally in clustered form through the project scripts.

## Recommended Local Cluster

```bash theme={null}
./scripts/start_cluster.sh start --clean --build
```

Typical local shape:

* backend nodes on `3000`, `3001`, `3002`
* dashboard UI on `3100`

## Cluster Management Endpoints

* `POST /v1/cluster/initialize`
* `POST /v1/cluster/join`
* `DELETE /v1/cluster/nodes/:node_id`

## Join Payload

```json theme={null}
{
  "node_id": 2,
  "address": "127.0.0.1:5002"
}
```

## Example Initialization

```bash theme={null}
curl -s -X POST http://127.0.0.1:3000/v1/cluster/initialize \
  -H "Authorization: Bearer $TOKEN"
```

## Example Join

```bash theme={null}
curl -s -X POST http://127.0.0.1:3000/v1/cluster/join \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "node_id": 2,
    "address": "127.0.0.1:5002"
  }'
```

## Operational Notes

* In single-node mode, join and leave operate on the local raft group.
* In sharded mode, cluster operations fan out across shard groups.
* Leader forwarding is built into write paths, but operational cluster control still expects a healthy Raft topology.
