在Debian上遷移GitLab數據庫的步驟如下:
服務器環境信息:
在新服務器安裝相同版本的GitLab:
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-16.2.4-ce.0.el7.x86_64.rpm
yum -y install gitlab-ce-16.2.4-ce.0.el7.x86_64.rpm
備份原GitLab數據:
gitlab.rb 和 gitlab-secrets.json:scp /etc/gitlab/gitlab.rb root@192.168.2.200:/etc/gitlab/
scp /etc/gitlab/gitlab-secrets.json root@192.168.2.200:/etc/gitlab/
gitlab-rake gitlab:backup:create
mkdir -p /var/opt/gitlab/backups
scp /var/opt/gitlab/backups/1725431200_2024_09_04_16.2.4_gitlab_backup.tar root@192.168.2.200:/var/opt/gitlab/backups/
chmod 777 /var/opt/gitlab/backups/1725431200_2024_09_04_16.2.4_gitlab_backup.tar
還原GitLab數據:
gitlab-ctl stop nginx
gitlab-ctl stop puma
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1725431200_2024_09_04_16.2.4
gitlab-secrets.json 文件:scp /etc/gitlab/gitlab-secrets.json root@192.168.2.200:/etc/gitlab/
gitlab-ctl restart
訪問GitLab:
請注意,以上步驟可能因GitLab版本和服務器配置的不同而有所差異。在執行遷移之前,請確保詳細閱讀GitLab官方文檔,并在測試環境中進行充分測試。