GitLab备份

 本机备份

利用crontab备份
#定时备份

0 9-21/4 * * 1-5 /opt/gitlab/bin/gitlab-rake gitlab:backup:create

#删除超过7天的备份

30 2 * * * find "/var/opt/gitlab/backups/" -name "*.tar" -mtime +7 -type f -exec rm -rf {} \;

#每5分钟同步时间

5 * * * * /usr/sbin/ntpdate us.pool.ntp.org

异机备份

#利用rsync(需提前配置)进行同步,此同步只是同步源主机备份的tar包

30 10-22/6 * * *  rsync -vzrtopg --progress --delete --password-file=/etc/rsync_client.pass backup@192.168.6.102::gitlab /var/opt/gitlab/backups/

#数据源同步

5 10-22/2 * * * rsync -vzrtopg --progress --delete --password-file=/etc/rsync_client.pass backup@192.168.6.102::opt_gitlab /opt/gitlab

5 10-22/2 * * * rsync -vzrtopg --progress --delete --exclude backups/ --password-file=/etc/rsync_client.pass backup@192.168.6.102::var_opt_gitlab /var/opt/gitlab

注意:

    1.同步源数据需要关闭备份机上的GitLab服务

    2.第二步同步/var/opt/gitlab具体可以同步这个目录 /var/opt/gitlab/git-data/repositories



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值