1. 程式人生 > 其它 >|NO.Z.00016|——————————|CloudNative|——|CI/CD&GitLab操作 .V06|----------------------------------------------------|GitLab.備份|定時備份|

|NO.Z.00016|——————————|CloudNative|——|CI/CD&GitLab操作 .V06|----------------------------------------------------|GitLab.備份|定時備份|



[CloudNative:CI/CD&GitLab操作.V06]                                                                    [Applications.CloudNative] [|CI/CD|分散式版本控制系統|**3節點**|Jenkins|Git|——|Gitlab語言環境|Gitlab初始化|] [https|smtp|Gitlab取消使用者自動註冊|ssh|gitlab資料備份|定時備份|gitlab資料恢復|gitlab管理k8s叢集|]








一、檢視系統資訊
### --- 檢視系統資訊
~~~     檢視系統版本和軟體版本

[root@server11 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core) 
[root@server11 ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
13.10.0
二、gitlab備份
### --- 檢視備份相關的配置
~~~     檢視gitlab備份引數
~~~     該項定義了預設備份出文件的路徑,可以通過修改該配置,
~~~     並執行 gitlab-ctl reconfigure 或者 gitlab-ctl restart 重啟服務生效。

[[email protected] ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/data/gitlab/backups"
### --- 重啟gitlab server

[root@server11 ~]# gitlab-ctl restart
### --- 備份gitlab

[root@server11 ~]# /opt/gitlab/bin/gitlab-rake gitlab:backup:create
三、定時備份
### --- gitlab定時備份
~~~     可以到/data/gitlab/backups找到備份包,解壓檢視,
~~~     會發現備份的還是比較全面的,資料庫、repositories、build、upload等分類還是比較清晰的。

[[email protected] ~]# crontab -e
0 2 * * * bash /opt/gitlab/bin/gitlab-rake gitlab:backup:create
四、設定備份保留時長
### --- 防止每天執行備份,有目錄被爆滿的風險,
~~~     開啟/etc/gitlab/gitlab.rb配置檔案,找到如下配置:
~~~     設定備份保留7天(7360024=604800),秒為單位,如果想增大或減小,
~~~     可以直接在該處配置,並通過gitlab-ctl restart 重啟服務生效。
~~~     備份完成,會在備份目錄中生成一個當天日期的tar包。

[[email protected] ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_keep_time'] = 604800








===============================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)