Project

General

Profile

Actions

Support #4252

open

Backup & Recovery

Added by Raj Thakkar about 8 years ago. Updated about 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
29.09.2016
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

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

Actions #1

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

Actions #2

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?

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

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.

Actions #7

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
Actions

Also available in: Atom PDF