# AGGREGATOR SET AS MASTER

The `AGGREGATOR SET AS MASTER` command promotes a child aggregator to master aggregator.

## Syntax

```sql
AGGREGATOR SET AS MASTER;

```

## Remarks

* This command should only be used in cases where the master aggregator is permanently lost. The command [PROMOTE AGGREGATOR … TO MASTER](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/promote-aggregator-to-master.md) is required for all other use cases that require the promotion of a child aggregator to master.
* This command must be run on the child aggregator node to be promoted to master (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md) ). If this command is run while your cluster has an online master aggregator, it will return an error.
* For version 7.1 and older, see [Previous Versions](https://docs.singlestore.com/#section-idm459346749335203267107166623.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
AGGREGATOR SET AS MASTER;

```

```output

Query OK, 1 row affected (1 min 22.41 sec)

```

**Related Topics**

* [Aggregator](https://docs.singlestore.com/db/v9.1/introduction/distributed-architecture/cluster-components/#UUID-5ab4d9d6-9704-50a3-e36b-47484a35ad81.md)
* [PROMOTE AGGREGATOR … TO MASTER](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/promote-aggregator-to-master.md)

## Previous Versions

In previous versions of SingleStore, `AGGREGATOR SET AS MASTER` required the following procedure:

1. Stop any DDL queries and writes to reference tables.

2. Confirm that the cluster and reference databases (if any) are in sync between the master aggregator and child aggregator to be promoted. To check the position of databases, create a connection to the MemSQL node and run the `SHOW DATABASES EXTENDED` command.

3. Disable detection of leaf failures and trigger failovers on the child aggregator. Set `leaf_failure_detection` variable on the target child aggregator to off. Perform this step from the master aggregator. If the current master aggregator is unresponsive, skip this step.

4. Stop the master aggregator using the `memsql-ops memsql-stop <master_aggregator_ID>` or `sdb-admin stop-node --memsql-id <master_aggregator_ID>` command. Make sure the master aggregator is offline before proceeding.

5. Clear the DNS cache on all the nodes in the cluster using the `FLUSH HOSTS` command.

6. Promote the child aggregator to the master aggregator. Run the `AGGREGATOR SET AS MASTER` command on the target child aggregator. Execute the `SELECT @@master_aggregator` query. This query should return `self`.

7. Enable leaf failure detection on the master aggregator. Set `leaf_failure_detection` variable to `ON`.

8. Remove the old master aggregator from the cluster using `REMOVE AGGREGATOR`.

9. Delete the old master aggregator. Run the `memsql-ops memsql-delete <node_ID>` or `sdb-admin delete-node <node_ID>` command.

***

Modified at: June 11, 2026

Source: [/db/v9.1/reference/sql-reference/cluster-management-commands/aggregator-set-as-master/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/aggregator-set-as-master/)

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