Gitlab 備份遷移恢復 (bug: gitlab-ce.10.8.x restore )

1. 版本信息html

OS: centos 6.9 
Gitlab: gitlab-ce.10.7.4 gitlab-ce.10.8.0 gitlab-ce.10.8.3 gitlab-ce.10.8.4

2. 數據備份git

https://segmentfault.com/a/1190000014729115
 參考以上url 便可完成數據備份。

3. Gitlab數據還原程序員

https://segmentfault.com/a/1190000014729115
 參考以上url 便可完成數據備份還原。

4.Gitlab數據還原失敗segmentfault

緣由:gitlab版本restore存在bug,目錄權限問題致使還原失敗。
issue:https://gitlab.com/gitlab-org/gitlab-ce/issues/46891

first:
#scp 1528963129_2018_06_14_10.8.4_gitlab_backup.tar 192.168.99.115:`pwd`
#chown git.git /var/opt/gitlab/backups/*.tar
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore

**錯誤提示:**
[DONE]
done
Restoring uploads ...
tar: .: Cannot mkdir: No such file or directory
tar: Exiting with failure status due to previous errors
Backup failed

各位看官,看到該提示是否是超蛋疼,大腦飄過十萬個草泥馬!別急,能解決的,咱能夠手動;

5. Gitlab的備份過程centos

Dumping database ... 
Dumping PostgreSQL database gitlab hq_production ... [DONE]
done
Dumping repositories ...
 * arch/k-calc ... [DONE]
 * arch/sms ... [DONE]
 * 
done
Dumping uploads ... 
done
Dumping builds ... 
done
Dumping artifacts ... 
done
Dumping pages ... 
done
Dumping lfs objects ... 
done
Dumping container registry images ... 
[DISABLED]
Creating backup archive: 1528963129_2018_06_14_10.8.4_gitlab_backup.tar         
... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done

其實就是使用tar打包過程,db 和 repositories 除外!! 

各位看官,說到這裏是否是想起來點什麼,繼續往下看哦 !!!

6.數據還原過程ide

Unpacking backup ... done
Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.

Do you want to continue (yes/no)? yes
Removing all tables. Press `Ctrl-C` within 5 seconds to abort
Cleaning the database ... 
done
Restoring database ... 
Restoring PostgreSQL database gitlabhq_production ... SET
SET
SET
 set_config 
GRANT
[DONE]
done
Restoring repositories ...
 * arch/k-calc ... [DONE]
 * arch/sms ... [DONE]
Put GitLab hooks in repositories dirs [DONE]
done
Restoring uploads ... 
....

7.解決數據還原gitlab

#cd /var/opt/gitlab/backups
#ls 
1528963129_2018_06_14_10.8.4_gitlab_backup.tar  backup_information.yml  db                      
pages.tar.gz  tmp artifacts.tar.gz builds.tar.gz lfs.tar.gz  repositories      
uploads.tar.gz

restore handy:
#tar xf uploads.tar.gz -C /var/opt/gitlab/gitlab-rails/uploads
#tar xf builds.tar.gz -C /var/opt/gitlab/gitlab-ci/builds
#tar xf pages.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/pages
#tar xf artifacts.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/artifacts

看到這裏是否是欣喜若狂,畢竟Gitlab是基礎服務,程序員的結晶之地啊!!!

注意: db、repositories 的數據已經還原,瞭解本質過程很重要的,萬物皆有相剋!!!

若是數據還原沒有提到的,請自行腦補啊,不在多作累述!!!

#如下命令對還原數據可靠性檢測
#gitlab-ctl reconfigure
#gitlab-ctl restart
#gitlab-rake gitlab:check SANITIZE=true

8. 新舊域名更改redirectui

#grep -rn "external_url" /etc/gitlab/gitlab.rb
  external_url "http://gitlab.xxxxx.com"
#gitlab-ctl reconfigure
#gitlab-ctl restart

redirect 問題:
    點擊admin area,而後左下角setting,找到「登陸限制」的 Home page URL,修改成新的域名便可!!!

文件夾權限參考url

https://docs.gitlab.com/omnibus/settings/configuration.html

若有問題或者想打賞,支付寶924133662@qq.com !!!rest

相關文章
相關標籤/搜索