# REMOVE LEAF

Removes a leaf node from a cluster without deleting its data.

This command rebalances the leaf node’s partitions into the remaining leaves on the cluster and removes the specified leaf node from the Master Aggregator. Consequently, the leaf node will be removed from the [SHOW LEAVES](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/show-leaves.md) command. A leaf node that has been removed can be added back to the cluster, without any loss of data, by using the [ADD LEAF](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/add-leaf.md) command.

While the cluster will no longer know about this leaf node, Toolbox will still know that `memsqlctl` recognizes that there is a running `memsql` process which is now in the `unknown` state.

## Syntax

```sql
REMOVE LEAF 'host':port [FORCE] [KILL] [ENSURE_PARTITION_SAFETY]

```

## FORCE

`REMOVE LEAF` is designed to keep the database online while you remove a leaf from the cluster. However, if you want to remove a leaf node without keeping the database online (for example, during maintenance operations), then use the `FORCE` option to disable automatic rebalancing. When specified, it disables the rebalancing behavior of `REMOVE LEAF`.

During some operational workflows, when `leaf_failure_detection` is `OFF`, a leaf may be marked as online even when it is unreachable, presumably due to connection errors. To remove such leaves, enable `remove_leaf_force_remove_online_leaf` and run the `REMOVE LEAF` command with the `FORCE` option. In this configuration, the `REMOVE LEAF` command ignores any connection errors and treats the leaf as offline for the duration of the command. Refer to [List of Engine Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/list-of-engine-variables.md) for more information on the respective engine variables.

## KILL

`KILL` prevents persistent long running write queries from blocking a clustering option for an arbitrarily long time (for example, a scale up or scale down or even an upgrade). Auto-rebalances automatically use the `KILL` mode if the auto-rebalance fails to run after three attempts.

## ENSURE\_PARTITION\_SAFETY

`ENSURE_PARTITION_SAFETY` prevents a leaf (or leaves) from being removed if it contains the last online instance of a partition.

## Remarks

* The default port is `3306`.
* If the leaf does not have a pair, SingleStore will rebalance its partitions onto the remaining leaves before removing it. After this rebalance process is over, the databases partition that were moved are no longer present on the node.
* You must use the `ADD LEAF` command if you want to reintroduce the removed leaf into the cluster.
* Refer to [sdb-admin delete-node](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/delete-node.md) to delete a leaf node and its data.
* This command can be run on the master aggregator node, or a child aggregator node (refer to [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md) ).
* If MemSQL Ops is not enabled for manual cluster control, then a `REMOVE LEAF` can result in the leaf being added back without user intervention.
* This command causes implicit commits. Refer to [COMMIT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/commit.md) for more information.
* Refer to the [Permission Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Example

```sql
REMOVE LEAF '192.168.1.110':3306;

```

## REMOVE LEAVES

Removes all leaf nodes without removing the data.

Refer to the [REMOVE LEAF](https://docs.singlestore.com/#UUID-8c789e2e-818b-014a-fbf5-f206fe46af6a.md) section for more information.

> **📝 Note**: `REMOVE LEAVES` is an all-or-nothing command, either all the leaves will be removed, or none of them will.

## Syntax

```sql
REMOVE LEAVES [IF EXISTS] ('host_1':port_1, ..., 'host_n':port_n) [FORCE] [ENSURE_PARTITION_SAFETY]
```

## Example

```sql
REMOVE LEAVES ('192.168.1.110':3306, '192.168.1.111':3306, '192.168.1.112':3306);
```

## Related Topics

* [Cluster Management Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md)
* [ADD LEAF](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/add-leaf.md)
* [DETACH LEAF](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/detach-leaf.md)

***

Modified at: March 10, 2026

Source: [/db/v9.1/reference/sql-reference/cluster-management-commands/remove-leaf/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/remove-leaf/)

(An index of the documentation is available at /llms.txt)
