Gitlabバックアップとリカバリ
1699 ワード
1、gitlabバックアップとリカバリ
参照先:https://docs.gitlab.com/ce/raketasks/backup_restore.html
sudo gitlab-rake gitlab:backup:create
/var/opt/gitlab/backups, /etc/gitlab/gitlab.rb
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
docker
docker exec -t gitlab-rake gitlab:backup:create
( )
gitlab_rails['backup_upload_connection'] = {
:provider => 'Local',
:local_root => '/mnt/backups'
}
The directory inside the mounted folder to copy backups to Use '.' to store them in the root directory gitlab_rails['backup_upload_remote_directory'] = 'gitlab_backups'
アーカイブ権限のバックアップ # In /etc/gitlab/gitlab.rb, for omnibus packages
gitlab_rails['backup_archive_permissions'] = 0644 # Makes the backup archives world-readable
(Omnibus) :/etc/gitlab/gitlab.rb 、/etc/gitlab/gitlab-secrets.json
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
30 ,
gitlab_rails['backup_keep_time'] = 2592000
2、Omnibusインストール回復 gitlab.rb ( /var/opt/gitlab/backups)
sudo cp 1504793137_2017_09_07_9.5.3_gitlab_backup.tar /var/opt/gitlab/backups/
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status
,
sudo gitlab-rake gitlab:backup:restore BACKUP=1504793137_2017_09_07_9.5.3
> Unpacking backup ... tar: 1504796591_2017_09_07_9.5.3_gitlab_backup.tar: Cannot open: Permission denied
chmod git:git 1504796591_2017_09_07_9.5.3_gitlab_backup.tar
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true
sudo gitlab-rake gitlab:backup:create
/var/opt/gitlab/backups, /etc/gitlab/gitlab.rb
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
docker
docker exec -t gitlab-rake gitlab:backup:create
( )
gitlab_rails['backup_upload_connection'] = {
:provider => 'Local',
:local_root => '/mnt/backups'
}
# In /etc/gitlab/gitlab.rb, for omnibus packages
gitlab_rails['backup_archive_permissions'] = 0644 # Makes the backup archives world-readable
(Omnibus) :/etc/gitlab/gitlab.rb 、/etc/gitlab/gitlab-secrets.json
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
30 ,
gitlab_rails['backup_keep_time'] = 2592000
2、Omnibusインストール回復 gitlab.rb ( /var/opt/gitlab/backups)
sudo cp 1504793137_2017_09_07_9.5.3_gitlab_backup.tar /var/opt/gitlab/backups/
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status
,
sudo gitlab-rake gitlab:backup:restore BACKUP=1504793137_2017_09_07_9.5.3
> Unpacking backup ... tar: 1504796591_2017_09_07_9.5.3_gitlab_backup.tar: Cannot open: Permission denied
chmod git:git 1504796591_2017_09_07_9.5.3_gitlab_backup.tar
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true
gitlab.rb ( /var/opt/gitlab/backups)
sudo cp 1504793137_2017_09_07_9.5.3_gitlab_backup.tar /var/opt/gitlab/backups/
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status
,
sudo gitlab-rake gitlab:backup:restore BACKUP=1504793137_2017_09_07_9.5.3
> Unpacking backup ... tar: 1504796591_2017_09_07_9.5.3_gitlab_backup.tar: Cannot open: Permission denied
chmod git:git 1504796591_2017_09_07_9.5.3_gitlab_backup.tar
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true