Support #4252
open
Added by Raj Thakkar about 8 years ago.
Updated about 8 years ago.
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
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?
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
Hi Bert,
The restore in this case can be only done on empty database. Did you destroy and create a database again ?
Cheers
No. Can you provide the correct commands to destroy? It looks like the restore creates a new DB.
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
Also available in: Atom
PDF