gitlab数据迁移

由于Gitlab自身的兼容性问题,高版本的Gitlab无法恢复低版本备份的数据,需要注意在b服务器部署和a服务器一样版本的gitlab。

查看gitlab版本的命令:

[root@dev-new dev-tools]# gitlab-rake gitlab:env:info

System information
System:         CentOS 7.4.1708
Current User:   git
Using RVM:      no
Ruby Version:   2.3.5p376
Gem Version:    2.6.13
Bundler Version:1.13.7
Rake Version:   12.0.0
Redis Version:  3.2.5
Git Version:    2.13.5
Sidekiq Version:5.0.4
Go Version:     unknown

GitLab information
Version:        10.0.0
Revision:       bbf5c73
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://localhost:8081
HTTP Clone URL: http://localhost:8081/some-group/some-project.git
SSH Clone URL:  git@localhost:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        5.9.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

备份原服务器上的的数据:

gitlab-rake gitlab:backup:create RAILS_ENV=production

备份后的文件一般是位于/var/opt/gitlab/backups下, 自动生成文件名文件名如1573539278_2019_11_12_10.0.0_gitlab_backup.tar

将生成的tar文件拷贝到新服务器上相应的backups目录下
可以利用scp进行直接拷贝。

scp root@192.168.10.2:/var/opt/gitlab/backups/1573539278_2019_11_12_10.0.0_gitlab_backup.tar /var/opt/gitlab/backups/

在新服务器恢复数据:

gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1573539278_2019_11_12_10.0.0

如果提示权限不足,请修改文件操作权限后再执行上面的命令:

chmod 755 /var/opt/gitlab/backups/1573539278_2019_11_12_10.0.0_gitlab_backup.tar

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值