gitlab備份與恢復
1.docker-compose部署gitlab
cat docker-compose.yaml
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ce:17.4.2-ce.0'
restart: always
hostname: 'git.ope.ai'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://git.aa.ai:8999'
gitlab_rails['gitlab_shell_ssh_port'] = 8222
ports:
- '8999:8999'
- '8222:22'
volumes:
- ./config:/etc/gitlab
- ./logs:/var/log/gitlab
- ./data:/var/opt/gitlab
shm_size: '256m'
2.常用備份命令
默認備份目錄為/var/opt/gitlab/backups
也可能為/home/gitlab
docker exec gitlab-web1 gitlab-backup create (適合數據量小)
docker exec gitlab-web1 gitlab-rake gitlab:backup:create STRATEGY=copy (更適合數據量大時,會占用更多的磁盤)
3.gitlab數據恢復命令
(1)恢復備份 當你需要從備份中恢復時,首先確保 GitLab 已停止服務:
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
(2)然后移動備份文件到 GitLab 備份目錄,并執行恢復命令:
sudo gitlab-backup restore BACKUP=
其中
(3)最后重啟 GitLab:
sudo gitlab-ctl start

浙公網安備 33010602011771號