1.gitlab備份
1.修改配置文件/etc/gitlab/gitlab.rb
gitlab_rails['manage_backup_path'] = true #是否開啟自動備份功能
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" #默認的備份目錄
gitlab_rails['backup_keep_time'] = 604800 #自動備份的時長
注:看目錄大小更改備份的目錄、
2.如果更改了備份目錄虏冻,則創(chuàng)建對應的目錄
mkdir -p 目錄
**3.重新初始化gitlab(不會影響數(shù)據(jù))(不修改目錄不用初始化)
[root@git-10.0.0.3 ~]# gitlab-ctl reconfigure
4.手動執(zhí)行備份命令痪署,會將備份的結(jié)果存儲至"/var/opt/gitlab/backups(根據(jù)配置文件)
[root@git-10.0.0.3 ~]# gitlab-rake gitlab:backup:create
[root@git-10.0.0.3 ~]# cd /var/opt/gitlab/backups/
[root@git-10.0.0.3 /var/opt/gitlab/backups]# ls
1573107195_2019_11_07_10.0.1_gitlab_backup.tar #不要修改文件名字
5.加入定時任務(wù)
[root@git-10.0.0.3 ~]# crontab -e
* * * * * gitlab-rake gitlab:backup:create &>/dev/null
2.gitlab恢復
1.停止數(shù)據(jù)寫入服務(wù)
[root@git-10.0.0.3 ~/demo/info_no]# gitlab-ctl stop unicorn
[root@git-10.0.0.3 ~/demo/info_no]# gitlab-ctl stop sidekip
2.通過gitlab-rake命令進行恢復(恢復時要指定此前備份的名稱,不需要寫_gitlab_backup.tar后綴)
[root@git-10.0.0.3 /var/opt/gitlab/backups]# gitlab-rake gitlab:backup:restore BACKUP=1573175391_2019_11_08_10.0.1
3.gitlab升級
1.下載gitlab新版本
[root@git-10.0.0.3 ~]# wget -c https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.1.9-ce.0.el7.x86_64.rpm
2.備份一下gitlab
[root@git-10.0.0.3 ~]# gitlab-rake gitlab:backup:create
3.停止gitlab相關(guān)服務(wù)
[root@git-10.0.0.3 ~]# gitlab-ctl stop unicorn
[root@git-10.0.0.3 ~]#gitlab-ctl stop sidekiq
[root@git-10.0.0.3 ~]#gitlab-ctl stop nginx
4.安裝新版本gitlab
[root@git-10.0.0.3 ~]# yum localinstall -y gitlab-ce-12.1.9-ce.0.el7.x86_64.rpm
5.啟動并查看gitlab版本
[root@git-10.0.0.3 ~]# gitlab-ctl reconfigure
[root@git-10.0.0.3 ~]#gitlab-ctl restart
gitlab升級
1.卸載老版本
[root@git-10.0.0.3 ~]# yum erase gitlab-ce.x86_64
2.安裝新版本
[root@git-10.0.0.3 ~]# yum localinstall gitlab-ce-12.1.9-ce.0.el7.x86_64.rpm
3.重新初始化
[root@git-10.0.0.3 ~]# gitlab-ctl reconfigure
4.查看版本