迁移说明
- 旧gitlab环境地址:192.168.15.240
- 新gitlab环境地址:192.168.15.241
- 新旧环境的gitlab版本必须一致
- Jenkins备份路径:/var/opt/gitlab/backups/
1、备份旧gitlab(192.168.15.240)
[root@localhost ~]# gitlab-rake gitlab:backup:create
2、复制旧gitlab备份文件到新gitlab(192.168.15.240)
[root@localhost ~]# scp /var/opt/gitlab/backups/1552914145_2019_03_18_11.4.5_gitlab_backup.tar root@192.168.15.240:/var/opt/gitlab/backups/
3、还原新gitlab(192.168.15.241)
[root@localhost ~]# gitlab-ctl stop unicorn
[root@localhost ~]# gitlab-ctl stop sidekiq
[root@localhost ~]# chmod -R 777 /var/opt/gitlab/backups
[root@localhost ~]# chmod -R 777 /opt/gitlab/embedded
[root@localhost ~]# cd /var/opt/gitlab/backups/
[root@localhost ~]# gitlab-rake gitlab:backup:restore BACKUP=1552914145_2019_03_18_11.4.5
如有提示,可收到处理一下文件:
restore handy:
[root@localhost ~]# cd /var/opt/gitlab/backups
[root@localhost backups]# tar xf uploads.tar.gz -C /var/opt/gitlab/gitlab-rails/uploads
[root@localhost backups]# tar xf builds.tar.gz -C /var/opt/gitlab/gitlab-ci/builds
[root@localhost backups]# tar xf pages.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/pages
[root@localhost backups]# tar xf artifacts.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/artifacts
以下命令对还原数据可靠性检测
[root@localhost backups]# gitlab-ctl reconfigure
[root@localhost backups]# gitlab-ctl restart
[root@localhost backups]# gitlab-rake gitlab:check SANITIZE=true
4、附录-注意事项
以下文件可能需要手动复制:
/var/opt/gitlab/.ssh/authorized_keys
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb
/var/opt/gitlab/gitlab-rails/etc/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/premailer-rails-1.9.7/example/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/graphiql-rails-1.4.10/test/dummy/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/generators/rails/app/templates/config/secrets.
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/graphql-1.8.1/spec/dummy/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/hashie-forbidden_attributes-0.1.1/test/dummy/config/secrets.yml
/opt/gitlab/embedded/service/gitlab-rails/config/secrets.yml