1查看gitlab备份配置
默认地址:vim /etc/gitlab/gitlab.rb
149 # gitlab_rails['manage_backup_path'] = true
150 # gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
151 # gitlab_rails['backup_archive_permissions'] = 0644 # See: http://doc.gitlab.com/ce/raketasks/backup_restore.html#backup-archive-permissions
152 # gitlab_rails['backup_pg_schema'] = 'public'
153 # gitlab_rails['backup_keep_time'] = 604800
可以看到备份后的文件地址为/var/opt/gitlab/backups。
2开始备份
命令为:gitlab-rake gitlab:backup:create
[root@gitlab gitlab]# gitlab-rake gitlab:backup:create
`/var/opt/gitlab` is not writable.
Bundler will use `/tmp/bundler/home/root' as your home directory temporarily.
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
Compressing database ... [DONE]
done
Dumping repositories ...
* IC/test-project ... [DONE]
* IC/test-project.wiki ... [SKIPPED]
* OC/document ... [DONE]
* OC/document.wiki ... [SKIPPED]
* pangqian/RD-Center ... [DONE]
* pangqian/RD-Center.wiki ... [SKIPPED]
* IC/document ... [DONE]
* IC/document.wiki ... [SKIPPED]
* OC/SUB_SYSTEM ... [DONE]
* OC/SUB_SYSTEM.wiki ... [SKIPPED]
3查看备份
[root@gitlab backups]# ll /var/opt/gitlab/backups
总用量 5791024
-rw-------. 1 git git 5930004480 3月 23 14:06 1521785168_gitlab_backup.tar
4数据恢复
停止相关服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
查看gitlab状态
gitlab-ctl status
cd /data/gitlab/backups
gitlab-rake gitlab:backup:restore BACKUP=1521785168
稍等片刻,就可以继续访问了。
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |