码迷,mamicode.com
首页 > 其他好文 > 详细

Gitlab备份和恢复操作记录

时间:2017-11-12 14:57:14      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:ges   sql   文件   ase   product   serve   epo   记录   direct   

 

前面已经介绍了Gitlab环境部署记录,这里简单说下Gitlab的备份和恢复操作记录:

1)Gitlab的备份目录路径设置

[root@code-server ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails[‘backup_path‘] = "/data/gitlab/backups"
[root@code-server ~]# mkdir -p /data/gitlab/backups
[root@code-server ~]# chown -R git.git /data/gitlab/backups
[root@code-server ~]# chmod -R 777 /data/gitlab/backups

如上设置了gitlab备份目录路径为/data/gitlab/backups,最后使用下面命令重载gitlab配置文件,是上述修改生效!
root@code-server ~]# gitlab-ctl reconfigure

2)GItlab备份操作(使用备份命令"gitlab-rake gitlab:backup:create")

手动备份gitlab
[root@code-server ~]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * treesign/treesign ... [DONE]
 * treesign/treesign.wiki ...  [SKIPPED]
 * gateway/gateway ... [DONE]
 * gateway/gateway.wiki ...  [SKIPPED]
 * treesign/treesign-doc ... [SKIPPED]
 * treesign/treesign-doc.wiki ...  [SKIPPED]
 * qwsign/qwsign ... [DONE]
 * qwsign/qwsign.wiki ...  [SKIPPED]
 * qwsign/qwsign-doc ... [DONE]
 * qwsign/qwsign-doc.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: 1510465955_2017_11_12_9.4.5_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@code-server ~]# cd /data/gitlab/backups/
[root@code-server backups]# ll
total 216
-rw------- 1 git git 215040 Nov 12 13:52 1510465955_2017_11_12_9.4.5_gitlab_backup.tar

编写备份脚本,结合crontab实施自动定时备份,比如每天0点、6点、12点、18点各备份一次
[root@code-server backups]# pwd
/data/gitlab/backups
[root@code-server backups]# cat gitlab_backup.sh 
#!/bin/bash
/usr/bin/gitlab-rake gitlab:backup:create
[root@code-server backups]# chmod 755 gitlab_backup.sh
[root@code-server backups]# crontab -l
#gitlab备份
0 0,6,12,18 * * * /bin/bash -x /data/gitlab/backups/gitlab_backup.sh > /dev/null 2>&1

 

Gitlab备份和恢复操作记录

标签:ges   sql   文件   ase   product   serve   epo   记录   direct   

原文地址:http://www.cnblogs.com/kevingrace/p/7821529.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!