gitlab4.0备份还原

gitlab4.0备份还原

一,备份

备份默认路径查看:

gitlab/config/gitlab.yml 中的backup: 默认tmp/backups ====》这个是gitlab/tmp/backups/  可不是系统的tmp/backups

gitlab4.0备份还原

进入gitlab账户下执行备份命令

bundle exec rake gitlab:backup:create  ===>必须在Gemfile 所在的目录下执行

gitlab4.0备份还原

 

如果备份报错

rake aborted!
cannot load such file — rb-inotify
/home/gitlab/gitlab/config/application.rb:9:in `<top (required)>’
/home/gitlab/gitlab/Rakefile:5:in `require’
/home/gitlab/gitlab/Rakefile:5:in `<top (required)>

解决方案:

bundle exec rake assets:precompile RAILS_ENV=production  ==》生成资产标签

bundle exec rake gitlab:backup:create RAILS_ENV=production ===》指定环境变量

 二,迁移 

停止所有的gitlab服务:

service gitlab stop

pkill nginx

将备份文件放在新服务器的bakups目录下

备份文件权限修改为777:  chmod 777 xxxx

恢复:sudo -u gitlab -H bundle exec rake gitlab:backup:restore BACKUP=1541820252 RAILS_ENV=production

重启gitlab  nginx服务

 

该版本会会出现仓库无法正常还原的问题:

解决方案:

cd /home/git/

tar zcvf repositories.tar.gz ./repositories/  ===》把仓库压缩成tar包

scp repositories.tar.gz root@xxxx:/opt    ===>发送至备份服务器

cp /opt/repositories.tar.gz /home/git

chown git:git repositories.tar.gz 

mv repositories repositories_old

tar zxvf repositories.tar.gz -C /home/git/

 重启gitlab nginx 服务

转载于:https://www.cnblogs.com/zy1234567/p/9937505.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/101328.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号