# Changing an IP Address in a Rolling Fashion (no downtime for reads)

This topic describes how to change the IP addresses for one or more hosts in a SingleStore cluster.

**Part 1 - Change the IP of leaf nodes one availability group at a time**

2. [disable-nodes-autostart](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/disable-nodes-autostart.md) - Use this only if you need to restart the host to change the IP else skip this step.

3. Shut down the node:

   If it is a leaf, first remove the leaf entry by running:
   ```sql
   REMOVE LEAF '<IP of OLD leaf>':<port> FORCE;

   ```

4. Change the IP address.

5. Unregister the old leaf from `sdb-toolbox-config`:
   ```shell
   sdb-toolbox-config unregister-host --host <old_ip_address_here>
   ```

6. When you re-register the host under the new IP, by default it should automatically find the old nodes.hcl file (as it should be the same host, just with a new IP) andyou can skip this step as the nodes will already be registered. However, if you have lost a config file then you need to register the new leaf to `sdb-toolbox-config`:
   ```shell
   sdb-toolbox-config register-host --host <new_ip_address_here>
   ```

7. Add the leaf node to the cluster:
   ```sql
   ADD LEAF user[:'password']@'<new_ip_address_here>':<node_port>;sdb-admin start-node --all

   ```

8. [Enable autorestart](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/enable-nodes-autostart.md), if you had executed Step 1.

**Part 2 - Change the IP of the Child Aggregator (one Child Aggregator at a time)**

1. [disable-nodes-autostart](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/disable-nodes-autostart.md) - Use this only if you need to restart the host to change the IP else skip this step.

2. [Stop the child aggregator node.](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/stop-node.md)

3. Remove the aggregator from the cluster:
   ```sql
   REMOVE AGGREGATOR 'host':port;
   ```

4. Change the IP address of the host.

5. Unregister the old host from `sdb-toolbox-config`:
   ```shell
   sdb-toolbox-config unregister-host --host <old_ip_address_here>
   ```

6. Register the new host to `sdb-toolbox-config`:
   ```shell
   sdb-toolbox-config register-host --host <new_ip_address_here>
   ```

7. Register the node to `sdb-admin`:
   ```shell
   sdb-admin register-node --memsql-config /path/to/memsql.cnf --host <new_ip_address_here>
   ```

8. [Start the node.](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/start-node.md)

9. Add the node as an aggregator to cluster:
   ```sql
   ADD AGGREGATOR user[:'password']@'<new_ip_address_here>':port;
   ```

10. [Enable autostart.](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/enable-nodes-autostart.md), if you had executed Step 1.

**Part 3 - PROMOTE one of the Child Aggregators to Master Aggregator**

To [promote a child aggregator](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands/promote-aggregator-to-master.md) to master aggregator, execute:

```sql
PROMOTE AGGREGATOR '<host>':<port> TO MASTER;
```

**Part 4 - Change the old Master Aggregator IP**

See the steps in Part 2. The process is the same as removing a child aggregator as now the original MA is currently a CA since we promoted an existing CA to master.

**Part 5 - PROMOTE the previous Master Aggregator back to a Master Aggregator, if needed**

To promote the original master aggregator back to a master aggregator if needed, execute:

```sql
PROMOTE AGGREGATOR '<new_ip_of_original_MA>':<port> TO MASTER;
```

***

Modified at: August 10, 2023

Source: [/db/v9.1/user-and-cluster-administration/maintain-your-cluster/changing-an-ip-address-in-a-rolling-fashion-no-downtime-for-reads/](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/maintain-your-cluster/changing-an-ip-address-in-a-rolling-fashion-no-downtime-for-reads/)

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