> Source: https://docs.cyberelements.io/bastion/4.6/Installation/Dependencies/PostgreSQLCluster/Operation/PsqlChangeLeader/

# Switching the `LEADER` node

In some maintenance cases, it may be useful to switch the PostgreSQL cluster `LEADER` node in order to perform operations on it.

Before you can change the `LEADER` node, please [identify the current `LEADER` node](https://docs.cyberelements.io/bastion/4.6/Installation/Dependencies/PostgreSQLCluster/Operation/PsqlGetLeader/) of the PostgreSQL cluster and then connect to it as `root`.
Once connected as `root` to the `LEADER` node, run a command similar to the following to trigger an immediate switchover:

```
1
```

Replace `PSQL_NODE` with the name of the node that will become `LEADER`.

> **Failure**
>
> If the command fails, it is possible that the following settings have not been applied: [settings for the `patronictl`](https://docs.cyberelements.io/bastion/4.6/Installation/Dependencies/PostgreSQLCluster/Installation/Install/#additional-configurations-for-patronictl).

> **Example**
>
> For the following PostgreSQL cluster:
>
> ```
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> ```
>
> L'objectif est de passer le nœud `PSQL_1` en tant que `LEADER`.
> Il est donc d'abord nécessaire de se connecter en tant que `root` au nœud `PSQL_3` qui est l'actuel `LEADER`.
> Une fois connecté, l'exécution de la commande suivante permet la bascule immédiate du `LEADER` vers le nœud `PSQL_1` :
>
> ```
> 1
> ```
>
> La modification de la topologie est ensuite visible et vérifiable :
>
> ```
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> ```
