歡迎訪問我的個人博客網站:http://www.yanmin99.com/
一、gitlab備份
gitlab默認備份路徑在
/etc/gitlab/gitlab.rb
文件中,如下:gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
備份命令
gitlab-rake gitlab:backup:create
[root@k4483v ]# gitlab-rake gitlab:backup:create done Dumping uploads ... done Creating backup archive: 1502891743_gitlab_backup.tar ... done Uploading backup archive to remote storage ... skipped Deleting tmp directories ... done Deleting old backups ... skipping
生成備份文件:
1502891743_gitlab_backup.tar
,執行備份需要gitlab啓動狀態
二、gitlab恢復
1、恢復準備
//停止相關數據連接服務 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
2、
gitlab-rake gitlab:backup:restore
恢復gitlab-rake gitlab:backup:restore BACKUP=xxxxx
xxxxx代表備份編號,比如備份文件
1502891743_gitlab_backup.tar
的備份編號是15028917433、執行備份
[root@node401v ]#gitlab-rake gitlab:backup:restore BACKUP=1502891743 Put GitLab hooks in repositories dirs [DONE] done Restoring uploads ... done This will rebuild an authorized_keys file. You will lose any data stored in authorized_keys file. Do you want to continue (yes/no)? yes ...............................................................Deleting tmp directories ... done
4、執行
gitlab-ctl restart
重啓[root@node401v ]# gitlab-ctl status run: logrotate: (pid 31684) 16s; run: log: (pid 17595) 3042s run: nginx: (pid 31687) 16s; run: log: (pid 17572) 3044s run: postgresql: (pid 31699) 15s; run: log: (pid 17397) 3064s run: redis: (pid 31707) 15s; run: log: (pid 17323) 3070s run: sidekiq: (pid 31711) 14s; run: log: (pid 17556) 3046s run: unicorn: (pid 31713) 14s; run: log: (pid 17532) 3048s
三、遷移
1、備份數據、遷移準備工作
- A、把A:(10.209.4.160)服務器gitlab:(10.121.215.48)遷移到B服務器
- B、B服務器安裝gitlab,應該要和A服務器gitlab一致
2、下載指定更新的版本文件、A服務器:備份數據
[root@k4483v ]# gitlab-rake gitlab:backup:create [root@k4483v ]# ll total 1965644 -rw-r--r-- 1 git git 2012815360 Aug 16 21:55 1502891743_gitlab_backup.tar
默認備份目錄
/var/opt/gitlab/backups
3、、把A服務器備份1502891743_gitlab_backup文件copy到B服務器中
//把A服務器1502891743_gitlab_backup.tar複製到B服務器/home/j-yanmin/文件中 [root@k4483v ]# scp 1502891743_gitlab_backup.tar [email protected]:/home/j-yanmin/ //把B服務中/j-yanmin/1502891743_gitlab_backup.tar複製到B服務器/var/opt/gitlab/backups中 [root@k4483v ]# cp /home/jyanmin/1502891743_gitlab_backup.tar /var/opt/gitlab/backups
4、執行恢復命令
gitlab-rake gitlab:backup:restore BACKUP=xxx
[root@k4483v ]# gitlab-rake gitlab:backup:restore BACKUP=1502891743
四、升級
- 1、Gitlab升級