[root@tom01 tools]# vim /etc/gitlab/gitlab.rb
202 gitlab_rails[‘backup_path’] = “/data/backups/gitlab” 存储路径可自定义
206 gitlab_rails[‘backup_keep_time’] = 604800 保留备份时间 单位秒
创建存储目录
[root@tom01 tools]# mkdir -p /data/backups/gitlab
[root@tom01 tools]# chown -R git.git /data/backups/gitlab
重新加载配置
[root@tom01 tools]# gitlab-ctl reconfigure
[root@tom01 tools]# gitlab-ctl restart
ok: run: gitlab-workhorse: (pid 43180) 0s
ok: run: logrotate: (pid 43187) 1s
ok: run: nginx: (pid 43194) 1s
ok: run: postgresql: (pid 43204) 0s
ok: run: redis: (pid 43206) 1s
ok: run: sidekiq: (pid 43221) 1s
ok: run: unicorn: (pid 43226) 0s
备份命令
[root@tom01 tools]# gitlab-rake gitlab:backup:create
加入定时任务
[root@tom01 tools]# crontab -e
0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create
也可以在使用rsync增量备份
查看备份文件
[root@tom01 tools]# ls /