|NO.Z.00017|——————————|CloudNative|——|CI/CD&GitLab操作 .V07|----------------------------------------------------|GitLab.恢復|
阿新 • • 發佈:2022-03-27
[CloudNative:CI/CD&GitLab操作.V07] [Applications.CloudNative] [|CI/CD|分散式版本控制系統|**3節點**|Jenkins|Git|——|Gitlab語言環境|Gitlab初始化|] [https|smtp|Gitlab取消使用者自動註冊|ssh|gitlab資料備份|定時備份|gitlab資料恢復|gitlab管理k8s叢集|]
一、gitlab恢復
二、檢視備份相關的配置項### --- gitlab server部署 ~~~ 參照前面部署方案
### --- 檢視備份相關的配置項
~~~ 修改該配置,定義了預設備份出文件的路徑,
~~~ 並執行 gitlab-ctl reconfigure 或者 gitlab-ctl restart 重啟服務生效。
[root@server11 ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/data/gitlab/backups"
三、恢復前需要先停掉資料連線服務
四、同步備份檔案到新伺服器### --- 停止unicorn、sidekiq ~~~ 如果是臺新搭建的主機,不需要操作,理論上不停這兩個服務也可以。 ~~~ 停這兩個服務是為了保證資料一致性。 [root@server11 ~]# gitlab-ctl stop unicorn [root@server11 ~]# gitlab-ctl stop sidekiq
### --- 將老伺服器/data/gitlab/backups目錄下的
~~~ 備份檔案拷貝到新伺服器上的/data/gitlab/backups
[root@server11 gitlab]# rsync -avz 1530773117_2019_03_05_gitlab_backup.tar 192.168.95.135:/data/gitlab/backups/
五、執行命令進行恢復~~~ 注意許可權:600許可權是無權恢復的。 實驗環境可改成了777,生產環境建議修改屬主屬組 [root@server11 backups]# pwd /data/gitlab/backups [root@server11 backups]# chown -R git.git 1530773117_2019_03_05_gitlab_backup.tar [root@server11 backups]# ll total 17328900 -rwxrwxrwx 1 git git 17744793600 Jul 5 14:47 1530773117_2018_07_05_gitlab_backup.tar
### --- 後面再輸入兩次 yes 就完成恢復了。
~~~ 注意:backups 目錄下保留一個備份檔案可直接執行
[root@server11 ~]# gitlab-rake gitlab:backup:restore BACKUP=1530773117_2018_07_05_gitlab_backup.tar
六、恢復完成啟動服務
### --- 恢復完成後,啟動剛剛的兩個服務,或者重啟所有服務,再開啟瀏覽器進行訪問,
~~~ 發現數據和之前的一致:
~~~ 通過備份檔案恢復gitlab必須保證兩臺主機的gitlab版本一致,否則會提示版本不匹配
[root@server11 ~]# gitlab-ctl start unicorn
[root@server11 ~]# gitlab-ctl start sidekiq
~~~ #OR
[root@server11 ~]# gitlab-ctl restart
===============================END===============================
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart ——W.S.Landor
來自為知筆記(Wiz)