git迁移MySQL数据库_gitlab完整迁移

环境介绍:

CentOS 6.7

gitlab:6.3.1

需求:gitlab从A服务器迁移至B服务器

第一、在B服务器上部署gitlab环境

参考《GitLab完整搭建(版本6.3.1)》

第二、备份A服务器上的数据

1).打包仓库文件#su- git

$cd/home/git/

$tarzcvf repositories.tar.gz ./repositories

2).备份sql文件$mysqldump-uroot -pxxxx gitlabhq_production > /tmp/gitlabhq_production.sql

3).备份keys$cp/home/git/.ssh/authorized_keys /tmp/authorized_keys

4).复制1-3步的文件到B服务器$scprepositories.tar.gz gitlabhq_production.sql authorized_keys root@B:/tmp/

第三、在B服务器上导入数据

1).导入仓库,检查权限$cd/home/git

$tarzxvf repositories.tar.gz

如果权限有异常,直接重新赋权$chown-R git.git /home/git/repositories/

2).导入数据库$mysql-uroot -pxxx gitlabhq_production 

3).导入keys$catauthorized_keys >> /home/git/.ssh/authorized_keys

4.将文件导入ruby$cd/home/git/gitlab/

$bundleexec rake gitlab:import:repos RAILS_ENV=production

$bundleexec rake gitlab:satellites:create RAILS_ENV=production

5).检测$bundleexec rake gitlab:check RAILS_ENV=production

如果检测没有异常,可以重启gitlab服务#/etc/init.d/gitlab restart

第四、验证git pull/push与异常解决

1). git pull

18061509004a2335156b5d6f635bb350.png

2). git push

ed3f14baa6c5db26909ef0ce37195bc7.png

如果报错:

git.exe push --progress "origin"master:master

Counting objects: 3, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 350 bytes | 0bytes/s, done.

Total 3 (delta 0), reused 0 (delta 0)

remote: GitLab: An unexpected erroroccurred (redis-cli returned 1).

remote: error: hook declined to updaterefs/heads/master

To http://192.168.4.251/caoyang/test1121.git

! [remote rejected] master -> master(hook declined)

error: failed to push some refs to‘http://192.168.4.251/caoyang/test1121.git‘

屏蔽 /home/git/gitlab-shell/config.yml 28行redis配置

0d419f4fd5863a36c0e141951314b59e.png

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值