当前位置: 首页 > news >正文

Gitlab 备份与恢复

备份

1、备份数据(手动备份)

gitlab-rake gitlab:backup:create

2、备份数据(定时任务备份)

[root@localhost ]# crontab -l
00 1 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
说明:每天凌晨1点备份数据
数据默认保存路径:/var/opt/gitlab/backups/

还原

1、还原数据
1.1、复制数据到新Gitlab默认备份目录

cp 备份文件_gitlab_backup.tar /var/opt/gitlab/backups/

1.2、设置备份文件权限

chown git.git 备份文件_gitlab_backup.tar

1.3、使用如下命令恢复数据
1.3.1、停止 Gitlab

gitlab-ctl stop unicorn
gitlab-ctl stop sideki

1.3.2、还原数据

[root@localhost ]# gitlab-rake gitlab:backup:restore BACKUP=1690391227_2023_07_27_12.3.4-ee
Unpacking backup ... done
Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.Do you want to continue (yes/no)? yes   # 输入yes
Removing all tables. Press `Ctrl-C` within 5 seconds to abort
2023-07-27 16:07:36 +0800 -- Cleaning the database ... 
2023-07-27 16:07:46 +0800 -- done
2023-07-27 16:07:46 +0800 -- Restoring database ... 
Restoring PostgreSQL database gitlabhq_production ... SET

1.3.3、重启 Gitlab

[root@localhost ]# gitlab-ctl restart
ok: run: alertmanager: (pid 19043) 0s
ok: run: gitaly: (pid 19067) 0s
ok: run: gitlab-exporter: (pid 19087) 1s
ok: run: gitlab-workhorse: (pid 19089) 0s
ok: run: grafana: (pid 19093) 0s
ok: run: logrotate: (pid 19120) 0s
ok: run: nginx: (pid 19133) 0s
ok: run: node-exporter: (pid 19289) 0s
ok: run: postgres-exporter: (pid 19300) 1s
ok: run: postgresql: (pid 19318) 0s
ok: run: prometheus: (pid 19320) 0s
ok: run: redis: (pid 19338) 0s
ok: run: redis-exporter: (pid 19343) 0s
ok: run: sidekiq: (pid 19358) 0s

1.4、打开web页面,查看数据是否正常
在这里插入图片描述
说明:输入账号密码,查看数据是否已恢复完成

http://www.lryc.cn/news/99862.html

相关文章:

  • 数据库—用户权限管理(三十三)
  • C语言【怎么定义变量?】
  • vue中使用vab-magnifier实现放大镜效果
  • 无涯教程-jQuery - Highlight方法函数
  • 【bar堆叠图形绘制】
  • ORACLE数据库灾难恢复
  • base和正则备份
  • ArcGIS Engine 与 Visual Studio版本对照表
  • JPA连接达梦数据库导致auto-ddl失效问题解决
  • 【MATLAB第60期】【更新中】基于MATLAB的ARMAX具有外生回归因子的移动平均自回归模型
  • Vue 常用指令 v-on 自定义参数,事件修饰符
  • 重要通知|关于JumpServer开源堡垒机V2版本产品生命周期的相关说明
  • 下载快 kaggle output
  • 结构型设计模式-1.代理设计模式
  • Python(四十九)获取列表指定元素的索引
  • 年轻人的第一套海景房
  • Vue输入内容/链接生成二维码
  • 使用langchain与你自己的数据对话(二):向量存储与嵌入
  • No105.精选前端面试题,享受每天的挑战和学习
  • 【计算机网络】第 3 课 - 计算机网络体系结构
  • 精细呵护:如何维护自己的电脑,提升性能和寿命
  • DevOps-Jenkins
  • Jasper裁员,成也GPT,败也GPT
  • 安卓开发后台应用周期循环获取位置信息上报服务器
  • 为什么你的独立站有流量没转化?如何做诊断检查?
  • 【深度学习】【三维重建】windows10环境配置PyTorch3d详细教程
  • 【算法和数据结构】257、LeetCode二叉树的所有路径
  • yolov5的后处理解析
  • Java中注解应用场景
  • verilog