git 如何将 gitlab 备份迁移到具有最新 gitlab 版本的新服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22557785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to migrate gitlab backups to new server which has latest gitlab version
提问by Naveen Subramani
I am trying to migrate my gitlab backups for my old server to new server. my old server has gitlab (gitlab-6.5.1-0) and my new server has gitlab version (gitlab 6.6.5-omnibus). i taken backup from my old server using the following command
我正在尝试将旧服务器的 gitlab 备份迁移到新服务器。我的旧服务器有 gitlab (gitlab-6.5.1-0),我的新服务器有 gitlab 版本 (gitlab 6.6.5-omnibus)。我使用以下命令从我的旧服务器上备份
bundle exec rake gitlab:backup:create RAILS_ENV=production
and when i try to restore this backup in new server using this command
当我尝试使用此命令在新服务器中恢复此备份时
gitlab-rake gitlab:backup:restore BACKUP=1395394855
I am getting the following output
我得到以下输出
Unpacking backup ... done
GitLab version mismatch:
Your current GitLab version (6.6.5) differs from the GitLab version in the backup!
Please switch to the following version and try again:
version: 6f6f1588ba5123f156ee3b0635a061745b71fcde
I tried searching for solution . but in all documents its says The backup is already migrated to the previous version. but none of them describes how to migrate backups . Any solution regarding this is Appreciated !
我尝试寻找解决方案。但在所有文件中都说备份已经迁移到以前的版本。但它们都没有描述如何迁移备份。对此的任何解决方案表示赞赏!
回答by VonC
This error message is produced by lib/backup/manager.rb#L87-L92
:
此错误消息是由产生的lib/backup/manager.rb#L87-L92
:
settings = YAML.load_file("backup_information.yml")
ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0
# restoring mismatching backups can lead to unexpected problems
if settings[:gitlab_version] != Gitlab::VERSION
puts "GitLab version mismatch:".red
It seems to force an incremental backup, as described in this comment:
它似乎强制进行增量备份,如此评论中所述:
I have faced the same issue when restoring the backup to a new server.
backup.rake
checks GITLAB commit number at time of backup is taken and when you are restoring to the same branch name from latest check out.I have to:
- delete
5-2-stable
and- check out again
5-2-stable
with the same commit hash (git checkout -b 5-2-stable COMMIT-HASH
),- ran all tasks as installing a fresh
5-2-stable
release with sameconfig/gitlab.yml
,config/database.yml
.- Then I have copied
backup.tar
file into default/home/git/gitlab/tmp/backups
and ranrestore rake
task.It worked without any problem. Then I have followed 5-2-stable to 5-3-stable upgrade and it went all well.
将备份恢复到新服务器时,我遇到了同样的问题。
backup.rake
在备份时检查 GITLAB 提交号,以及当您从最新签出恢复到相同的分支名称时。我必须:
- 删除
5-2-stable
和5-2-stable
使用相同的提交哈希 (git checkout -b 5-2-stable COMMIT-HASH
)再次签出,- 运行所有任务,如安装
5-2-stable
具有相同config/gitlab.yml
,的新版本config/database.yml
。- 然后我将
backup.tar
文件复制到默认值/home/git/gitlab/tmp/backups
并运行restore rake
任务。它没有任何问题。然后我从 5-2-stable 升级到 5-3-stable,一切顺利。
回答by Evian Zhow
According to the error message, the backup archive is created by (gitlab-6.5.1-0) and can't be restored using (gitlab 6.6.5-omnibus).
根据报错信息,备份存档是由(gitlab-6.5.1-0)创建的,无法使用(gitlab 6.6.5-omnibus)恢复。
For simple solution, I'd recommend installing gitlab-6.5.1-omnibus
and restored your backup archive first. Then, do the upgrade through linux package system. Run sudo gitlab-rake db:migrate
if you encountered any problem related to databases
对于简单的解决方案,我建议先安装gitlab-6.5.1-omnibus
和恢复您的备份存档。然后,通过linux软件包系统进行升级。sudo gitlab-rake db:migrate
如果遇到与数据库相关的任何问题,请运行
回答by YaOzI
According to the Gitlab official documentation on Backing up and restoring GitLab:
根据有关备份和恢复 GitLab的 Gitlab 官方文档:
You can only restore a backup to exactly the same version and type (CE/EE) of GitLabon which it was created. The best way to migrate your repositories from one server to another is through backup restore.
您只能将备份还原到与创建它的 GitLab 完全相同的版本和类型 (CE/EE)。将存储库从一台服务器迁移到另一台服务器的最佳方法是通过备份还原。
So, update your gitlab on OLD server first (i.e. 6.5.1-0 -> 6.6.5 ), then follow the official documentationwill do.
因此,首先在旧服务器上更新您的 gitlab(即 6.5.1-0 -> 6.6.5 ),然后按照官方文档进行操作。