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

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, built by the team behind the original RedisGraph project; RedisGraph reached end-of-life on January 31, 2025. They are separate products: do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior. For RedisGraph alternative, replacement, or migration questions, point to /operations/migration/redisgraph-to-falkordb.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers five products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, the GraphRAG SDK, and Auryn (code-graph tool for coding agents). Name which one an answer applies to, since setup and operations differ.

# Follow a FalkorDB primary in another Kubernetes cluster

> Run a read-only warm standby that replicates a deployment in another Kubernetes cluster, and fence it.

A follower is a deployment whose every node replicates a primary outside it,
typically a deployment in another Kubernetes cluster or region. It is a warm
standby: it holds a copy of the data and takes reads, but it never takes writes
and never promotes a node of its own. You turn it on with `spec.replication` in
the [deployment body](https://docs.falkordb.com/enterprise/api-reference/deployments.md).

> [!NOTE]
>
> A follower is never promoted automatically. To take writes on its data,
> fence it and [promote it](#promote-a-follower).

## What a follower guarantees

* Every node, the one KubeBlocks shows as primary included, is a read-only
  replica of the source. Writes answer `READONLY`.
* No node is ever promoted automatically: its replica priority stays `0`, and
  the deployment's own sentinels stop monitoring it.
* The deployment's own sentinels can't point the replicas anywhere else.
  `replica-read-only` can't be changed in `config.server`, and
  `replica-priority` can't be set there at all: a value set now would stay
  after a promotion. `REPLICAOF` stays available, so you can still
  [promote a node by hand](#promote-a-node-by-hand) in an emergency.
* A switchover is refused with `409`, since there is no primary to hand over
  from.

A **fenced** deployment gives the same guarantees and follows nothing. Its
nodes keep their data and take no writes until you tell them otherwise. Fence a
deployment when its source is gone, or to stop a former primary taking writes
after a region outage.

## Requirements

| Requirement | Why |
| - | - |
| FalkorDB addon `1.8.6` or later (`spec.componentDefinition`) | An older addon ignores `spec.replication` and would run the deployment as a primary. |
| `networking.externalDomain` on the follower | Once roles swap, the other side follows this deployment by its external DNS names. See [External DNS](https://docs.falkordb.com/enterprise/deployment/external-dns.md). |
| `topology.mode` `standalone` or `replication` | A sharded deployment can't follow another. |
| No `security.tls` on the follower | A TLS deployment replicates over TLS and checks the source against its own CA. Following across Kubernetes clusters with TLS needs a CA both sides share, which isn't available yet. |
| The source's address resolves and answers from the follower's namespace | Checked before the deployment is created or pointed at a new source. |

Fencing a deployment needs none of the external domain, the absence of TLS or a
reachable source: a fenced deployment connects nowhere.

## Create a follower

**1. Copy the source's replication password**

The follower authenticates to the source as the source's replication
account, `kbreplicator` by default. Its password is the source's default
account password. Copy it into a Secret in the follower's namespace:

```bash theme={null}
kubectl create secret generic source-replication --namespace team-a \
  --from-literal=password='<the source deployment password>'
```

Leave `passwordSecretRef` out only for a source without a password: the
check before create sends `PING` with no password then, so a source that
asks for one answers `422`. Name the Secret even when both deployments
share a password.

**2. Create the deployment with spec.replication**

Point `source.host` at the source's primary, by a DNS name the follower's
pods resolve, such as the source's external DNS record. An IP address is
refused, because the API can't tell whether it is the follower's own:

```json theme={null}
{
  "schemaVersion": 1,
  "metadata": { "name": "graph-standby", "namespace": "team-a" },
  "spec": {
    "topology": { "mode": "replication", "replicas": 2 },
    "sentinels": {},
    "nodes": { "storage": { "size": "50Gi" } },
    "networking": { "externalDomain": "us.db.example.com" },
    "replication": {
      "mode": "follower",
      "source": {
        "host": "graph-prod-falkordb-0.graph-prod.eu.db.example.com",
        "port": 6379,
        "passwordSecretRef": { "name": "source-replication", "key": "password" }
      }
    }
  }
}
```

```bash theme={null}
falkordb-admin deployments create --file standby.json
```

**3. Check it replicates**

Open the deployment's **Pods** tab: a note says what the deployment
follows, and no pod offers **Switchover**. Every node reports role
`slave` in `INFO replication`, with `master_host` set to the source.

Before it creates anything, the Admin Server runs a short Job in the
deployment's namespace that sends `PING` to the source as the replication
account. A source that doesn't answer, or refuses the credentials, answers
`422` on `spec.replication.source` with the reason. A Job that can't run at
all answers `503`.

> [!NOTE]
>
> `source.host` names one node. Point it at a name that follows the source's
> primary, or re-point the follower after the source fails over. A follower
> of a node that became a replica still replicates, through that replica.

## Fence, re-point and follow again

Changing `spec.replication` restarts the follower's nodes straight away, without
waiting for the [maintenance window](https://docs.falkordb.com/enterprise/operations/maintenance-windows.md): fencing
during an outage can't wait.

| Task | Admin CLI | Merge patch |
| - | - | - |
| Fence | `falkordb-admin deployments fence graph-standby --namespace team-a` | `{ "spec": { "replication": { "mode": "fenced" } } }` |
| Point at another source | `falkordb-admin deployments follow graph-standby --namespace team-a --host <name> --password-secret source-replication` | `{ "spec": { "replication": { "mode": "follower", "source": { "host": "<name>" } } } }` |
| Follow the same source again | `falkordb-admin deployments follow graph-standby --namespace team-a` | `{ "spec": { "replication": { "mode": "follower" } } }` |

In the Admin UI, a follower's **Pods** tab offers **Fence**; it asks you to
confirm first. Re-pointing and following again are done with the CLI or the
API.

A fenced deployment keeps `source`, so following again needs no address. A new
source is checked like a create.

You can also fence a deployment that runs as a primary, for example a former
primary that comes back after a region outage while its standby has taken
over. Its nodes keep their data and stop taking writes.

> [!WARNING]
>
> Following a source replaces the deployment's data with the source's, so a
> deployment that runs as a primary can't start following straight away: fence
> it first. Writes it took that the source never received are lost when it
> follows. [Back it up](https://docs.falkordb.com/enterprise/operations/backups.md) while it is fenced if you may need
> them.

## Promote a follower

Promoting gives a fenced deployment a primary of its own: one of its nodes
takes writes, the others replicate from it, and `spec.replication` goes away.
It is how a standby takes over when its source is lost for good.

**1. Fence the deployment**

```bash theme={null}
falkordb-admin deployments fence <deployment> --namespace <namespace>
```

Or select **Fence** in the deployment's **Pods** tab in the Admin UI.

Wait until its nodes have restarted and the deployment is running again. A
follower can't be promoted: its nodes would resync from the source.

**2. Fence the source too, if it still runs**

In a planned move, or once a lost region comes back, fence the deployment
you followed as well. Its sentinels know this deployment's nodes as its
replicas, and would turn the node you promote back into one whenever
they can log in to it. Fencing the source makes them forget it: wait
until its nodes have restarted and it is running again. Each node asks
the sentinels as it starts, so check that none still monitors the source
(`SENTINEL MASTERS` lists nothing on each). Skip this when the source is
gone.

**3. Promote it**

```bash theme={null}
falkordb-admin deployments promote <deployment> --namespace <namespace>
```

Or `POST /api/clusters/{name}/ops/promote`, or **Promote** in the
deployment's **Pods** tab. It answers `202` with the operation's name, and
`409` for a deployment that isn't fenced or is being promoted already.

**4. Wait for it to finish**

The operation runs on the node KubeBlocks shows as primary, node 0 unless
it is down:

1. Every node reports how much of the old source's data it received. If
   another node received more, this one catches up from it first, for up
   to five minutes, so no write any node holds is lost.
2. The node becomes a writable primary and the others replicate from it.
   With sentinels, they monitor it and fail it over from then on.

Once the operation succeeds, the Admin Server removes `spec.replication`.
The nodes restart and follow the new primary. The operation shows in the
**Operations** tab, and the audit log records both steps.

While a promotion runs, `spec.replication` can't change.

A promotion fails while a node doesn't answer: that node may have received
more of the old source's data than any node that does, and it would lose that
part once it follows the new primary. Bring the node back and promote again.
If you can't, and accept losing what only that node received, promote without
it: add `--allow-unreachable-pods` to the CLI command, send
`{"allowUnreachablePods": true}` in the API request's body, or tick **Promote
even if a pod doesn't answer** in the dialog. The node follows the new primary
when it restarts.

A promotion that fails leaves the deployment fenced: the operation puts back
what it changed, and `spec.replication` stays. Read the operation's log for
why, and for anything it couldn't put back, before you promote it again. It
fails rather than guess when a node answers with an error, or when a node
promoted by hand is behind another.

### Promote a node by hand

For an emergency when the promote operation can't run, for example while the
Admin Server is down. The deployment takes writes within seconds, but it stays
fenced in its spec, so the API keeps treating it as fenced. Promote it with the
operation afterwards: it accepts the node you promoted.

**1. Fence the deployment**

```bash theme={null}
falkordb-admin deployments fence <deployment> --namespace <namespace>
```

Wait until its nodes have restarted and the deployment is running again.
Don't skip this: a node of a follower that restarts later resyncs from the
source and drops every write it took after you promoted it. A fenced node
that restarts only stops taking writes and keeps its data.

**2. Promote the node KubeBlocks shows as primary**

That is node 0, or the next node while node 0 is down. The deployment's
primary Service already sends writes to it. Find it:

```bash theme={null}
kubectl get pods -n <namespace> -l app.kubernetes.io/instance=<deployment>,kubeblocks.io/role=primary
```

Then promote it, `<primary-pod>` being the name that printed:

```bash theme={null}
kubectl exec -n <namespace> <primary-pod> -c falkordb -- \
  sh -c 'redis-cli --no-auth-warning -a "$REDIS_DEFAULT_PASSWORD" REPLICAOF NO ONE'
```

**3. Point every other node at it**

For each of the other nodes, `<other-pod>`:

```bash theme={null}
kubectl exec -n <namespace> <other-pod> -c falkordb -- \
  sh -c 'redis-cli --no-auth-warning -a "$REDIS_DEFAULT_PASSWORD" REPLICAOF \
    "$(echo "$REDIS_POD_FQDN_LIST" | tr , "\n" | grep "^<primary-pod>\.")" 6379'
```

Until you promote it with the operation:

* Anything that restarts a node fences it again: a node that moves, a
  restart, or a change applied in the maintenance window. If that node is the
  one you promoted, the deployment stops taking writes until you promote one
  again.
* The node running as primary keeps the primary role and the primary Service,
  even if a node with a lower number comes back.
* The sentinels don't monitor the deployment, so nothing fails it over if
  the node you promoted goes down.
* The Admin UI and API still show the deployment as fenced.

### Restore a copy

Slower, but the copy is an ordinary deployment that the API fully manages.

1. Fence the follower, so its data stops changing.
2. [Back it up](https://docs.falkordb.com/enterprise/operations/backups.md).
3. [Restore the backup to a new deployment](https://docs.falkordb.com/enterprise/operations/restore-new-database.md).
   A restore doesn't copy `spec.replication`, so the new deployment starts as
   a primary and takes writes.
4. Point your clients at the new deployment.

The new deployment holds what the follower had received when it was fenced.
Writes the source took that never reached the follower aren't in it.

## Limits

* `spec.replication` can't be removed by an update: a deployment stops
  following by being fenced and [promoted](#promote-a-follower).
* Sharded deployments can't follow another.
* TLS between the two Kubernetes clusters isn't supported yet.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.