# ATTACH LEAF

The `ATTACH LEAF` command attaches a detached leaf into the cluster, re-introducing its data (if possible).

## Syntax

```sql
ATTACH LEAF 'host':port [FORCE] [NO REBALANCE]

```

## Remarks

* `ATTACH LEAF` will transition the leaf from the `detached` state to the `online` state. `ATTACH` is used to reintroduce a leaf back into the system. By default, `ATTACH LEAF` also performs any rebalance and resyncing actions needed to bring the leaf up to date with the rest of the cluster. To attach a leaf without rebalancing partitions, use the `NO REBALANCE` option. For more information see [REBALANCE PARTITIONS](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/rebalance-partitions.md) .
* `ATTACH LEAF` can only be run on leaf nodes that are present in `SHOW_LEAVES`.
* This command can be run on the master aggregator node, or a child aggregator node (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md) ).
* The `FORCE` flag overrides any conflicts that would prevent `ATTACH LEAF` from running. In practice, this happens when the data on the leaf has diverged away from the current state of the cluster (for example, a database was recreated while the leaf was down). You do not need to `ATTACH LEAF ... FORCE` by default. `ATTACH LEAF` without the `FORCE` flag collects information about which databases on the leaf are conflicting and the error message indicates directly that you should add the `FORCE` flag. By specifying the `FORCE` flag, you enable `ATTACH LEAF` to ignore the conflicting data on the node you are attaching. The `FORCE` flag does not drop the conflicting databases on the node, but you can remove orphaned database partitions on the leaf by running the `ATTACH LEAF FORCE` command followed by the `CLEAR ORPHAN DATABASES` command.
* If you want to reattach many leaves at one time, after restarting a cluster, for example, you can use [ATTACH LEAF ALL](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/attach-leaf-all.md).
* Detached leaves automatically reattach. To disable this feature, set the global variable `auto_attach` to `false`. For more information see [SET GLOBAL](https://docs.singlestore.com/db/v9.1/reference/sql-reference/operational-commands/set-global.md) .
* 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.
* See the [Permission Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permission.

## Example

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

```

```output

Query OK, 1 row affected (1.11 sec)

```

**Related Topics**

* [DETACH LEAF](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/detach-leaf.md)
* [ATTACH LEAF ALL](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/attach-leaf-all.md)

***

Modified at: June 11, 2026

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

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