# CLUSTER SET-CONFIG-EPOCH

> Set the configuration epoch of a new node that does not know any other node yet.

URL: https://docs.hotkv.com/commands/cluster-set-config-epoch/

```
CLUSTER SET-CONFIG-EPOCH config-epoch
```

- Group: Cluster
- Complexity: O(1)
- HotKV Cloud: not available
- On-Premise: no license needed

`CLUSTER SET-CONFIG-EPOCH` gives a fresh node a configuration epoch. When
you create a cluster, each primary should start with a different epoch, so
no two primaries ever claim the same slots with the same epoch.
`redis-cli --cluster create` assigns the slots, then a distinct epoch to
each primary with this command, and only then makes the nodes meet.

It works only on a node that knows no other node and whose epoch is still 0.
If the value is greater than the node's current epoch, that is raised too.

## Return value

Simple string `OK` in RESP2 and RESP3, or one of these errors:

| Case | Error |
| --- | --- |
| Not an integer | `ERR value is not an integer or out of range` |
| A negative value | `ERR Invalid config epoch specified: <epoch>` |
| The node knows other nodes | `ERR The user can assign a config epoch only when the node does not know any other node.` |
| The node's epoch is not 0 | `ERR Node config epoch is already non-zero` |
| Cluster mode is off | `ERR This instance has cluster support disabled` |

## Examples

```
127.0.0.1:6379> CLUSTER SET-CONFIG-EPOCH 1
OK
127.0.0.1:6379> CLUSTER SET-CONFIG-EPOCH 2
(error) ERR Node config epoch is already non-zero
```

## Compatibility

Same rules and error strings as Redis 7 and Valkey 8.

## See also

[CLUSTER BUMPEPOCH](https://docs.hotkv.com/commands/cluster-bumpepoch/index.md), [CLUSTER ADDSLOTS](https://docs.hotkv.com/commands/cluster-addslots/index.md),
[CLUSTER INFO](https://docs.hotkv.com/commands/cluster-info/index.md)

In a cluster: [Cluster troubleshooting](https://docs.hotkv.com/clustering/troubleshooting/index.md#nodes-disagree)