# Move a database to a new server

> Move a database to another server at a time you pick, with about a minute of downtime and a way back.

Source: https://rowsafe.sh/docs/guides/move

Move a database to a bigger server, another provider or a new region:

1. The **new server** becomes a [standby](https://rowsafe.sh/docs/guides/standby) and catches up. Nothing changes for your apps.
2. At the **time you pick** (or **Switch now**), it takes over. **Nothing is lost.** Apps are disconnected for about a minute.
3. The **old server stays stopped** for 7 days (or what you chose), as a way back.

A move needs both servers reporting. If the old one is gone, [promote the standby](https://rowsafe.sh/docs/guides/standby#promote-the-standby) instead. This page describes PostgreSQL; [By database](#by-database) says what differs.

## What you need

The same as [for a standby](https://rowsafe.sh/docs/guides/standby#what-you-need): the agent and an **empty cluster of the same major version** on the new server, and restarts allowed on both.

## Move

Click **Standby**, **Move to a new server**. Pick the server, when to switch, and how long to keep the old server. Confirm the new server's key fingerprint.

**Standby** shows progress. You can change the time or cancel. The switchover waits until the new server is in sync.

**With the CLI**

```sh
rowsafe move app --to db-2 --at "2026-10-03 23:00" --keep-days 7
rowsafe move app --to db-2          # no time: waits for you
rowsafe move switch app             # switch now
rowsafe move schedule app --at TIME # change the time
rowsafe move cancel app
rowsafe move back app               # switch back
rowsafe move finish app             # remove the old server
```

## At the switchover

- The old server is **fenced** (stopped and kept stopped). The new one replays everything and takes over. If it can't within 3 minutes, it doesn't switch and says why; [start the old one again](https://rowsafe.sh/docs/guides/standby#fencing-the-old-primary-stays-stopped) or switch anyway.
- Backups continue on the new server.
- Rowsafe poolers and apps that list both servers ([Connect your apps](https://rowsafe.sh/docs/guides/standby#connect-your-apps)) follow by themselves. **Standby** shows the new address for others.

## Switch back or remove the old server

Until the days run out:

- **Switch back** catches the old server up and moves the database back. Nothing is lost.
- **Remove old server** (type its name) lets it go. It stays stopped. Remove it on the **Servers** page when nothing else runs there.

After that, the old server stays stopped until you rebuild it as a standby or forget it.

## By database

The new server is set up like a standby for each engine.

- **MySQL and MariaDB** ([standby](https://rowsafe.sh/docs/guides/standby#mysql-and-mariadb)): the old server is made **read-only** instead of stopped.
- **MongoDB** ([standby](https://rowsafe.sh/docs/guides/standby#mongodb)): the switch is MongoDB's own election. The old server stays a read-only secondary.
- **ClickHouse** ([standby](https://rowsafe.sh/docs/guides/standby#clickhouse)): the old server is made **read-only**. Switching back rebuilds it; its databases are set aside (`rowsafe_before_*`).
- **Redis and Valkey** ([standby](https://rowsafe.sh/docs/guides/standby#redis-and-valkey)): the old server **refuses writes**. Backups continue from a fresh snapshot.

Only owners and admins can move a database; every step is audited. AI agents can switch, cancel or finish a move [as the person who connected them](https://rowsafe.sh/docs/guides/agent-autonomy), but not start one: a person must compare the new server's key.
