Gitlab 백업/복원
Gitlab 을 업데이트 하면서 보여지는 백업 메시지들은 다음과 같다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
## Databse Backup gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!) 2023-02-01 10:36:44 UTC -- Dumping main_database ... Dumping PostgreSQL database gitlabhq_production ... [DONE] 2023-02-01 10:36:46 UTC -- Dumping main_database ... done 2023-02-01 10:36:46 UTC -- Dumping ci_database ... [DISABLED] 2023-02-01 10:36:46 UTC -- Dumping repositories ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping uploads ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping builds ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping artifacts ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping pages ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping lfs objects ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping terraform states ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping container registry images ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Dumping packages ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Creating backup archive: 1675247804_2023_02_01_15.8.0_gitlab_backup.tar ... 2023-02-01 10:36:46 UTC -- Creating backup archive: 1675247804_2023_02_01_15.8.0_gitlab_backup.tar ... done 2023-02-01 10:36:46 UTC -- Uploading backup archive to remote storage ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Deleting old backups ... [SKIPPED] 2023-02-01 10:36:46 UTC -- Deleting tar staging files ... 2023-02-01 10:36:46 UTC -- Cleaning up /var/opt/gitlab/backups/backup_information.yml 2023-02-01 10:36:46 UTC -- Cleaning up /var/opt/gitlab/backups/db 2023-02-01 10:36:46 UTC -- Deleting tar staging files ... done 2023-02-01 10:36:46 UTC -- Deleting backups/tmp ... 2023-02-01 10:36:46 UTC -- Deleting backups/tmp ... done ### Backup Config gitlab preinstall: Automatically backing up /etc/gitlab Running configuration backup Creating configuration backup archive: gitlab_config_1675247806_2023_02_01.tar /etc/gitlab/ /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab.rb /etc/gitlab/trusted-certs/ /etc/gitlab/ssl/ /etc/gitlab/ssl/root-ca.crt /etc/gitlab/ssl/regi.gitlab.systemv.local.key /etc/gitlab/ssl/regi.gitlab.systemv.local.crt /etc/gitlab/ssl/gitlab.systemv.local.key /etc/gitlab/ssl/gitlab.systemv.local.crt /etc/gitlab/ssl/root-ca.key Configuration backup archive complete: /etc/gitlab/config_backup/gitlab_config_1675247806_2023_02_01.tar |
업데이트를 하기전에 데이터베이스와 설정 파일들을 백업하고 있다.
만일 전체 백업을 하고 싶다면 다음과 같이 명령어를 이용할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
]# gitlab-backup create ..... 2023-02-01 11:04:33 UTC -- Creating backup archive: 1675249277_2023_02_01_15.8.1_gitlab_backup.tar ... 2023-02-01 11:06:29 UTC -- Creating backup archive: 1675249277_2023_02_01_15.8.1_gitlab_backup.tar ... done 2023-02-01 11:06:29 UTC -- Uploading backup archive to remote storage ... [SKIPPED] 2023-02-01 11:06:29 UTC -- Deleting old backups ... [SKIPPED] 2023-02-01 11:06:29 UTC -- Deleting tar staging files ... 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/backup_information.yml 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/db 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/repositories 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/uploads.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/builds.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/artifacts.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/pages.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/lfs.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/terraform_state.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/registry.tar.gz 2023-02-01 11:06:29 UTC -- Cleaning up /var/opt/gitlab/backups/packages.tar.gz 2023-02-01 11:06:29 UTC -- Deleting tar staging files ... done 2023-02-01 11:06:29 UTC -- Deleting backups/tmp ... 2023-02-01 11:06:29 UTC -- Deleting backups/tmp ... done 2023-02-01 11:06:29 UTC -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data and are not included in this backup. You will need these files to restore a backup. Please back them up manually. 2023-02-01 11:06:29 UTC -- Backup 1675249277_2023_02_01_15.8.1 is done. 2023-02-01 20:06:29 +0900 -- Deleting backup and restore lock file |
수행후 생성된 백업 파일은 /var/opt/gitlab/backups 디렉토리에 만들어 진다.
만일 복원을 해야 한다면 백업 디렉토리에 백업한 파일을 올려놓고 다음과 같이 하면 된다.
1 2 3 4 5 |
## 프로세스 중지 ]# gitlab-ctl stop puma ]# gitlab-ctl stop sidekiq ## 복원 ]# gitlab-backup restore BACKUP=11493107454_2018_04_25_10.6.4-ce |