<a id="howto-member-shutdown"></a>

# How to shut down a MicroCloud cluster member

This guide provides instructions to safely shut down a MicroCloud cluster member. This includes how to deal with LXD instances running on the cluster member.

<a id="howto-member-shutdown-instances"></a>

## Stop or live-migrate all instances on the cluster member

To shut down a machine that is a MicroCloud cluster member, first ensure that it is not hosting any running LXD instances. Check to make sure that no project has any running instances on the target cluster member:

```bash
lxc ls --all-projects
```

Explicitly shutting down LXD will shut down all instances running on that cluster member:

```bash
sudo snap stop lxd
```

Alternatively, for instances that can be [live-migrated](https://canonical.com/microcloud/docs/default/lxd/howto/instances_migrate/#live-migration), you can migrate them to another cluster member without stopping them. See: [How to migrate LXD instances between servers](https://canonical.com/microcloud/docs/default/lxd/howto/instances_migrate/#howto-instances-migrate) for more information.

You can also temporarily migrate all instances on a machine to another cluster member by using cluster evacuation, then restore them to the original host after it is restarted. This method can live-migrate eligible instances; instances that cannot be live-migrated are automatically stopped and restarted. See: [Evacuate a cluster member](https://canonical.com/microcloud/docs/default/lxd/howto/cluster_manage/#cluster-evacuate) for more information.

<a id="howto-member-shutdown-restart"></a>

## Shut down and restart

Once there are no running instances on the cluster member, you can safely shut it down, then restart it if desired.
