운영환경
Linux : ubuntu 14.04
git version : 2.16.2
GitLab version : 10.4.4-ee
백업경로
# cd /var/opt/gitlab/backups 이고 이전파일은 삭제하지 않으니 참고하자.
백업파일 관련 설정
gitlab-ctl reconfigure를 할 때 자동으로 generate되는 파일이다.
# /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
# /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
1. 수동백업
# gitlab-rake gitlab:backup:create
2. 백업설정
백업공간을 지정한다. 운영중인 서버가 문제가 발생할 수 있기때문에 개인적으로 운영하는 파일서버용 하드(1TB)를 마운트했고 이를 경로로 지정했다.
설정파일을 열고 다음과 같이 수정했다.
# sudo vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
path : 백업파일 경로
keep_time : 604800(in seconds)
3. 백업 테스트
# sudo gitlab-rake gitlab:backup:create
백업결과는 다음과 같이된다.
포맷은 <timestamp>_<backup_date>_<gitlab_version>_gitlab_backup.tar로 지정된다.
4. 주기적으로 백업 설정하기
# crontab -e
매주 일요일(7) 새벽2시에 백업이 동작하도록 적용
* 2 * * 7 /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
[수정] 2018.3.12
매주 일요일 새벽2시 1분단위로 백업되더라..ㅜㅡㅜ (잘못설정했다..)
#sudo vi /etc/crontab
#gitlab backup (/FileServer/gitlab_backup)
0 2 * * 7 root /opt/gitlab/bin/gitlab-rake gitlab:backup:create
5. 복원하기
주의사항 - 복원하는 백업파일버전과 GitLab 버전이 동일해야한다.
프로세스를 먼저 정지시키고 상태를 확인한다.
# sudo gitlab-ctl stop unicorn
# sudo gitlab-ctl stop sidekiq
# sudo gitlab-ctl status
복원명령(백업파일을 /var/opt/gitlab/backups/에 옮기고 실행)
# sudo gitlab-rake gitlab:backup:restore BACKUP=<Timestamp>_<backup_date>_<GitLab_version>
ex) # sudo gitlab-rake gitlab:backup:restore BACKUP=1519826736_2018_02_28_10.4.4-ee
ex) # sudo -u git -H bundle exec rake RAILS_ENV=production gitlab:backup:restore BACUP=
1519826736_2018_02_28_10.4.4-ee
백업파일중 가장 최신 타임스탬프의 파일을 복구할때
# cd /FileServer/gitlab_backup
#
sudo
-u git -H bundle
exec
rake RAILS_ENV=production gitlab:backup:restore
'Server Security > Gitlab' 카테고리의 다른 글
[GitLab#5] MARKDOWN을 이용한 README.md 작성하기(기초와 문법) (0) | 2018.11.09 |
---|---|
[error memo]fatal: pathspec 'folder/Iconr' did not match any files (0) | 2018.06.20 |
[GitLab#4] SMTP 설정 (0) | 2018.03.19 |
[GitLab#2] SSL 설정 (0) | 2018.02.28 |
[GitLab#1] 설치하기 (0) | 2018.02.28 |