Support #4252
openBackup & Recovery
0%
Description
Hi,
What is the best approach to backup Rhodecode Enterprise?
How to restore a particular corrupted repository from a backup?
We are running Enterprise version: 4.4.0 on AWS Linux
Thanks.
-raj
Updated by Marcin Kuzminski [CTO] about 8 years ago
Hi Raj,
Here are the relevant docs on backup: https://docs.rhodecode.com/RhodeCode-Enterprise/admin/backup-restore.html
However if you are on AWS and you're using the image, it's possible to do a snapshot backup of the VM.
Cheers
Updated by Bert Zahniser about 8 years ago
Hi Marcin,
The link above documents how to backup the postgres db but does not provide the equivalent comment to restore. I tried simply using " psql -f postgresql-db-backup" but received the error: "psql: FATAL: role "rcdev" does not exist".
Can you provide the proper syntax for restoring?
Updated by Marcin Kuzminski [CTO] about 8 years ago
Hi Bert,
Thanks for the tip, i added the commands to our docs: here's the command for restoration of postgres: https://code.rhodecode.com/rhodecode-enterprise-ce/annotate/eb62cf1fa2f69a529acf41a0df26166251dadff9/docs/admin/backup-restore.rst#L-65
Updated by Bert Zahniser about 8 years ago
I'm getting errors attempting a restore. Dump works fine and I can view the dump file show the SQL creation commands followed by the COPY commands.
Here's the commands I am using:
PASSWORD=; export PASSWORD
pg_dump postgresql://postgres@127.0.0.1:5432/rhodecode > db_dump
Restore¶
psql -d postgresql://postgres@127.0.0.1:5432/rhodecode -1 -f db_dump
I get a ton of error messages. Here's the beginning of the output block:
SET
SET
SET
SET
SET
SET
CREATE EXTENSION
COMMENT
SET
SET
SET
psql:db_dump:41: ERROR: relation "cache_invalidation" already exists
psql:db_dump:44: ERROR: current transaction is aborted, commands ignored until end of transaction block
psql:db_dump:55: ERROR: current transaction is aborted, commands ignored until end of transaction block
psql:db_dump:58: ERROR: current transaction is aborted, commands ignored until end of transaction block
psql:db_dump:64: ERROR: current transaction is aborted, commands ignored until end of transaction block
Updated by Marcin Kuzminski [CTO] about 8 years ago
Hi Bert,
The restore in this case can be only done on empty database. Did you destroy and create a database again ?
Cheers
Updated by Bert Zahniser about 8 years ago
No. Can you provide the correct commands to destroy? It looks like the restore creates a new DB.
Updated by Marcin Kuzminski [CTO] about 8 years ago
The general chain of commands is:
- run a backup like in the docs
- drop the OLD database (we're assuming you're doing a restore on a new machine so OLD DB wouldn't exist)
PGPASSWORD=<password> psql -U <user> -h localhost -c 'drop database if exists 'rhodecode';
- Create a NEW empty database
PGPASSWORD=<password> psql -U <user> -h localhost -c 'create database 'rhodecode';
- Perform a restore like in docs