📖
notes
  • Study notes
  • Markdown入门
  • github及gitbook入门
  • Book
    • notes
      • Kubernetes
        • 实践
          • ceshi tongbu17:54
          • Creating a single control-plane cluster with kubeadm v1.22
          • Creating a single control-plane cluster with kubeadm v1.17
          • k8s v1.23 single
          • 单节点v1.23使用runtime未验证通过
      • Middleware
        • tinc
          • tinc 预备知识
      • shell
        • 如何才能学好Shell编程之“老鸟”经验谈
        • 实战
          • scripts
            • 迁移脚本
          • shell脚本调试
          • for和while读行的区别
          • 一个文件取2个参数
      • 虚拟化
      • 操作系统
        • Windows
          • winserver关闭事件跟踪程序
          • windows常用命令
          • win10企业LTSC版激活
          • debug-tools
        • Ubuntu
          • ubuntu networking
            • Network Configuration
      • Openstack
        • openstack基础
          • 网络虚拟化技术基础
          • openstack基础
          • 桥bridge
        • openstack安装和使用
          • 1、openstack涉及到的网络基础知识
          • 1、openstack涉及到的网络基础知识
          • 2、Environment
          • 3、stein版的最小安装
            • 3.1、keystone installation for Stein
            • 3.2、glance installation for Stein
            • 3.3、placement installation for Stein
            • 3.4、nova installation for Stein
            • 3.5、neutron installation for Stein
            • 3.6、cinder installation for Stein
          • 4、Launch an instance
          • 5、OpenStack Virtual Machine Image Guide
      • 网络基础
        • 网络工程师
        • 计算机网络原理
          • 1. 记录
          • 2. 数据链路层
          • 3. 网络层
        • url请求的过程
          • 大规模网站集群架构
          • 一个URL请求的全过程
          • HTTP和RPC
          • HTTP的几种请求方法
          • 一个URL请求的大概过程
        • 网络常用命令
          • 命令详解
            • nc
            • mtr
            • ss
            • lsof
            • IP
            • ipset
            • iptables
          • 抓包
          • 网络排错与观察
            • dig和nslookup
            • traceroute
            • netstat
        • 计算机网络协议
        • 负载均衡总结性说明
    • za
      • 一键安装gitlab后的备份和恢复
      • 恢复阿里云物理备份
      • 域名证书申请和更换
      • 服务器上排查问题得头5分钟
    • 单词
      • A
      • B
      • C
      • D
      • E
      • M
      • I
      • P
      • S
      • T
      • V
  • github不能自动同步到gitbook20240222
Powered by GitBook
On this page

Was this helpful?

  1. Book
  2. za

一键安装gitlab后的备份和恢复

https://docs.gitlab.com/ce/README.html

Omnibus packages

rpm -qa | grep gitlab-ce

sudo apt-cache policy gitlab-ce | grep Installed

*****

/etc/gitlab/gitlab.rb

包含的nginx,redis,数据库等,要改配置生效的话,都从gitlab.rb里面改

gitlab-ctl tail #查看是否有错误

gitlab-ctl reconfigure 加载配置文件

gitlab 为安装一体化,内置nginx/redis/postgresql等

gitlab 主程序目录: /var/opt/gitlab/

主配置文件: /var/opt/gitlab/gitlab-shell/config.yml

gitlab 认证文件: /var/opt/gitlab/.ssh/authorized_keys

日志文件: /var/log/gitlab/gitlab-shell/gitlab-shell.log

nginx 配置文件 : /var/opt/gitlab/nginx/conf/nginx.conf

/var/opt/gitlab/nginx/conf/gitlab-http.conf

3、所有与gitlab相关服务统一通过gitlab来启动

gitlab: 启动、关闭、重启方式: gitlab-ctl start | stop | restart

4、备份,还原和迁移

Gitlab创建备份

## gitlab-rake gitlab:backup:create

使用以上命令会在/var/opt/gitlab/backups目录下创建一个名称类似为1393513186_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1393513186是备份创建的日期。

Gitlab恢复

## 停止相关数据连接服务

gitlab-ctl stop unicorn

gitlab-ctl stop sidekiq

## 从1393513186编号备份中恢复

gitlab-rake gitlab:backup:restore BACKUP=1393513186

## 启动Gitlab

sudo gitlab-ctl start

迁移如同备份与恢复的步骤一样, 只需要将老服务器/var/opt/gitlab/backups目录下的备份文件拷贝到新服务器上的/var/opt/gitlab/backups即可(如果你没修改过默认备份目录的话)。但是需要注意的是新服务器上的Gitlab的版本必须与创建备份时的Gitlab版本号相同. 比如新服务器安装的是最新的8.5版本的Gitlab, 那么迁移之前, 最好将老服务器的Gitlab 升级为8.5再进行备份。

自动备份

通过crontab使用备份命令实现自动备份:

sudo su -

crontab -e

例如加入以下, 实现每天凌晨2点进行一次自动备份:

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create

PreviouszaNext恢复阿里云物理备份

Last updated 4 years ago

Was this helpful?