Backup:Restore on HA

Got a HA solution running, was messing around to make sure everything works and the backup:create rake command is fine.
Now the problem is when i attempt a restore, i followed the guide: https://docs.gitlab.com/ee/raketasks/backup_restore.html

After the rake restore command i get the following error if i don’t skip the DB backup:

rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "projects" does not exist
LINE 5:               AND cons.conrelid = '"projects"'::regclass
                                          ^
:             SELECT attr.attname
            FROM pg_attribute attr
            INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey)
            WHERE cons.contype = 'p'
              AND cons.conrelid = '"projects"'::regclass
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/repository.rb:176:in `restore'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:87:in `block (4 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:60:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "projects" does not exist
LINE 5:               AND cons.conrelid = '"projects"'::regclass
                                          ^
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/repository.rb:176:in `restore'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:87:in `block (4 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:60:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'

Can someone share some knowledge with me? Thanks

Found the solution.
The problem was when running the restore for the DB, i was running it on the applicational node, which would give the error, so the solution i found is to create 2 separated backups, 1 with everything except the DB (skip DB) and 1 with only the DB(skipp all but DB). when i want to restore it i need to run the restore in the applicational server and on the DB, with each respective backup file.

1 Like

Thanks for coming back with an answer for your issue and sharing it!

This topic was automatically closed after 4 days. New replies are no longer allowed.