|NO.Z.00016|——————————|CloudNative|——|CI/CD&GitLab操作 .V06|——|GitLab.备份|定时备份|
一、查看系统信息:
### --- 查看系统信息
~~~ 查看系统版本和软件版本
[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 重启服务生效。
[root@qfedu.com ~]# 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等分类还是比较清晰的。
[root@qfedu.com ~]# crontab -e
0 2 * * * bash /opt/gitlab/bin/gitlab-rake gitlab:backup:create
四、设置备份保留时长
### --- 防止每天执行备份,有目录被爆满的风险,
~~~ 打开/etc/gitlab/gitlab.rb配置文件,找到如下配置:
~~~ 设置备份保留7天(7360024=604800),秒为单位,如果想增大或减小,
~~~ 可以直接在该处配置,并通过gitlab-ctl restart 重启服务生效。
~~~ 备份完成,会在备份目录中生成一个当天日期的tar包。
[root@qfedu.com ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_keep_time'] = 604800
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
分类:
cdv015-jenkins2
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通