gitlab备份与恢复

模板网 2021-04-14

一、gitlab备份

[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * newgroup/test ... [SKIPPED]
 * newgroup/test.wiki ...  [SKIPPED]
 * zhangsan/zsproject ... [SKIPPED]
 * zhangsan/zsproject.wiki ...  [SKIPPED]
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping pages ...
done
Dumping lfs objects ...
done
Dumping container registry images ...
[DISABLED]
Creating backup archive: 1521890768_2018_03_24_10.6.0_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping

备份文件所在目录

[root@localhost ~]# ls /var/opt/gitlab/backups
1521890768_2018_03_24_10.6.0_gitlab_backup.tar

二、gitlab 恢复

需要停掉以下2个服务(停止数据的变更)

[root@localhost ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@localhost ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[root@localhost ~]# gitlab-rake backup:restore BACKUP=1521890768_2018_03_24_10.6.0
rake aborted!
Don't know how to build task 'backup:restore' (see --tasks)
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

启动服务 [root@localhost ~]# gitlab-ctl start

三、备份与还原过程中的权限问题

更多:https://jianshu.com/p/68a39c7193e7

mkdir /var/opt/gitlab/backups

chown git /var/opt/gitlab/backups

chmod 700 /var/opt/gitlab/backups

相关文章

  1. php自建邮局下邮件无法正常发送问题解决

    产生问题 自建邮局发邮件时提示错误信息:stream_set_blocking()... 这是因为PHP 5.6+版本强制要求验证服务器的有效性 PHP 5.6+特性 Stream wrappers

  2. python变量作用域

    在Python中并不是所有的语句块中都会产生作用域。只有当变量在Module(模块)、Class(类)、def(函数)中定义的时候,才会有作用域的概念。 需要注意的是:在if-elif-else、f

  3. 高并发下的分布式锁

    public String deductStrck() throws InterruptedException{ String lockKey = "product_001"; //用

  4. redis 运维常用命令

    time #查看时间戳与微妙数 dbsize #查看当前数据库中key数量 bgrewriteaof #后台进程重写aof bgsave #后台保存rdb快照 save #保存rd

  5. redis aof日志持久化

    一、aof的原理 问题: 1、每个命令重写一次aof? 2、某个key修改100次,产生100行记录,aof文件会很大,怎么解决? aof重写(简化) 二、aof的配置 appendfsync

随机推荐

  1. php自建邮局下邮件无法正常发送问题解决

    产生问题 自建邮局发邮件时提示错误信息:stream_set_blocking()... 这是因为PHP 5.6+版本强制要求验证服务器的有效性 PHP 5.6+特性 Stream wrappers

  2. python变量作用域

    在Python中并不是所有的语句块中都会产生作用域。只有当变量在Module(模块)、Class(类)、def(函数)中定义的时候,才会有作用域的概念。 需要注意的是:在if-elif-else、f

  3. 高并发下的分布式锁

    public String deductStrck() throws InterruptedException{ String lockKey = "product_001"; //用

  4. redis 运维常用命令

    time #查看时间戳与微妙数 dbsize #查看当前数据库中key数量 bgrewriteaof #后台进程重写aof bgsave #后台保存rdb快照 save #保存rd

  5. redis aof日志持久化

    一、aof的原理 问题: 1、每个命令重写一次aof? 2、某个key修改100次,产生100行记录,aof文件会很大,怎么解决? aof重写(简化) 二、aof的配置 appendfsync