1. 程式人生 > >gitlab4.0備份還原

gitlab4.0備份還原

一,備份

備份預設路徑檢視:

gitlab/config/gitlab.yml 中的backup: 預設tmp/backups ====》這個是gitlab/tmp/backups/  可不是系統的tmp/backups

進入gitlab賬戶下執行備份命令

bundle exec rake gitlab:backup:create  ===>必須在Gemfile 所在的目錄下執行

 

如果備份報錯

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服務