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 [email protected]::gitlab /var/opt/gitlab/backups/

#數據源同步

5 10-22/2 * * * rsync -vzrtopg --progress --delete --password-file=/etc/rsync_client.pass [email protected]::opt_gitlab /opt/gitlab

5 10-22/2 * * * rsync -vzrtopg --progress --delete --exclude backups/ --password-file=/etc/rsync_client.pass [email protected]::var_opt_gitlab /var/opt/gitlab

注意:

    1.同步源數據需要關閉備份機上的GitLab服務

    2.第二步同步/var/opt/gitlab具體可以同步這個目錄 /var/opt/gitlab/git-data/repositories



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章