Backups
A shared database has backups on from the moment it's created; for a dedicated one they are a paid option. Backups live on the database page, in the «Резервные копии» (Backups) section: the top shows whether they're on, below are the schedule, retention, cost and the list of finished backups.
A shared database is backed up once a day, and backups are kept for 7 days. You can turn them off, but then there's nothing to restore deleted data from.
Shared database
| What | How it works |
|---|---|
| By default | on |
| How often | once a day, by default at 03:00 Moscow time. The hour can be changed |
| How long they're kept | 1 to 7 days, your choice |
| Where they're stored | in separate storage, not on the database server |
| Storage space | they don't count toward the database quota |
| Price | included in the plan |
The backup hour and the retention period change with «Изменить настройки» (Change settings). If backups were turned off, turn them back on with «Резервные копии» → «Включить» (Backups → Turn on).
Dedicated database
Backups of a dedicated database are a paid option, off by default.
- «Резервные копии» → «Включить» (Backups → Turn on).
- Choose how many backups to keep: 1 to 14. A backup is taken once a day at night; the oldest one is pushed out by the new one.
- The dialog shows the calculation before you confirm: database, backups, and the monthly total.
The price of backups depends on the disk and the number of backups — see the examples on the Pricing page. The cost of backups is taken from the balance together with the database charge.
You can turn backups off at any time: backups already taken aren't deleted.
Make a backup manually
The «Сделать копию» (Make a backup) button at the top of the section takes an extra, off-schedule backup — for example, before a risky migration. The backup appears in the list with the status "being taken…", and once it's ready, with its size and buttons.
Restore
A finished backup has a «Восстановить» (Restore) button.
⚠️ The restore goes into the same database, over the current data, to the moment of the backup. Everything that appeared after the backup will be lost. You can't restore a database to an arbitrary point in time.
- A shared database is restored without stopping. While the restore is running, the application may see data in an intermediate state.
- A dedicated database is stopped for the duration of the restore: usually a few minutes, and the application can't connect during that time. The platform brings back role permissions and Data API access by itself.
When it's all done, the dashboard says: "Data restored to the moment of the backup".
If you need to pull a single table out of a backup rather than roll back the whole database, download the backup and restore it locally.
Download a backup
Download a backup with the arrow button in the row of a finished backup.
For a shared database the file is an ordinary PostgreSQL dump in
pg_dump -Fc format. You can restore it on any PostgreSQL server,
including outside Layero, with pg_restore:
pg_restore --no-owner --no-privileges -d postgresql://localhost/restored backup.dump
This is also how you move off Layero or keep a copy of your own just in case.
For a dedicated database the file is a snapshot of the whole disk. Its size equals the size of the database disk, not of the data: a database with an 8 GB disk and 60 MB of data gives an 8 GB file. To get a file the size of your data, take your own dump.
Your own dump
You can take a dump with your own tools for both shared and dedicated
databases — plain pg_dump with the connection string from the dashboard.
Check three things first.
- A
pg_dumpversion at least as new as the server. A shared database runs PostgreSQL 18, a dedicated one the version chosen when ordering. An earlierpg_dumprefuses to dump:aborting because of server version mismatch. Check the version withpg_dump --version. - Your address is on the allowed list. Otherwise the server answers
no authentication method is found. How to add an address — see "Who to let in". - The client has a root certificate. The connection string from the
dashboard requires
sslmode=verify-full, and without a root certificatepg_dumpfails withroot certificate file "…/root.crt" does not exist. Either put the certificate in place following "How to enable verify-full", or append&sslrootcert=systemto the string so thatpg_dumpuses the system root certificates. The officialpostgresDocker image has no system certificates, so there follow the instructions instead.
Then dump to an SQL file as usual:
pg_dump "postgresql://<role>:<password>@db.layero.ru:5432/<database>?sslmode=verify-full&sslrootcert=system" -f backup.sql
Restore such a file with psql -f backup.sql.
A dedicated database also supports archive formats, for example -Fc for
pg_restore. On a shared database the server answers archive formats
(-Fc, -Fd, -Ft) and the -C flag with
permission denied for table pg_db_role_setting: this system table is shared by all databases on the server and is closed to customers. If you need an archive format for a shared database, download a
backup from the dashboard.
Backup types in the list
A shared database's list can contain backups of two types:
| Type | What it is |
|---|---|
| «Копия в хранилище» (Storage backup) | uploaded off the server and survives even the loss of the server. It can be restored and downloaded |
| «Точка отката» (Rollback point) | a snapshot kept on the database server itself. It takes seconds and protects you from a mistake in the data, but not from losing the server |
What happens to backups when a database is deleted
Deleting a database also erases all its backups — immediately and irreversibly. If you might need a backup, download it before deleting.
If a database is deleted for non-payment, we try to save a backup before deleting it, but we don't guarantee it — see If the balance runs short. It's safer not to let it come to that: turn backups on and download a fresh one from time to time.