侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 450 篇文章
  • 累计创建 183 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

GitLab 迁移及恢复

WinJay
2023-04-21 / 0 评论 / 0 点赞 / 74 阅读 / 12764 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

GitLab 迁移及恢复

image-20230421102208327

处理备份文件

  • 新的Git Lab启动完成后,将备份文件移动到对应挂载的备份目录下,并进入容器
mv 1678378833_2023_03_10_15.6.2_gitlab_backup.tar Data/backups/
docker exec -it GitLab /bin/bash

image-20230322113918238

授权备份文件

进入容器后对备份文件进行授权,否则可能解压失败

cd /var/opt/gitlab/backups/
ls
1678378833_2023_03_10_15.6.2_gitlab_backup.tar
chmod 777 1678378833_2023_03_10_15.6.2_gitlab_backup.tar

image-20230322114237043

停止数据服务

# 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq


# 执行命令从备份文件中恢复Gitlab
gitlab-rake gitlab:backup:restore BACKUP=备份文件编号
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
gitlab-backup restore BACKUP=1652099118_2022_05_09_14.9.2-ee
Transfering ownership of /var/opt/gitlab/gitlab-rails/shared/registry to git
Unpacking backup ... done
2022-05-09 15:33:55 +0000 -- Restoring database ...
2022-05-09 15:33:55 +0000 -- Be sure to stop Puma, Sidekiq, and any other process that
connects to the database before proceeding. For Omnibus
installs, see the following link for more information:
https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations

Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.

Do you want to continue (yes/no)?yes
Removing all tables. Press `Ctrl-C` within 5 seconds to abort
2022-05-09 15:34:13 UTC -- Cleaning the database ...
2022-05-09 15:34:15 UTC -- done
Restoring PostgreSQL database gitlabhq_production ... ERROR:  must be owner of extension pg_trgm
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension pg_trgm

#这个报错不影响

2022-05-09 15:36:12 +0000 -- done
2022-05-09 15:36:12 +0000 -- Restoring uploads ...
2022-05-09 15:36:15 +0000 -- done
2022-05-09 15:36:15 +0000 -- Restoring builds ...
2022-05-09 15:36:15 +0000 -- done
2022-05-09 15:36:15 +0000 -- Restoring artifacts ...
2022-05-09 15:36:58 +0000 -- done
2022-05-09 15:36:58 +0000 -- Restoring pages ...
2022-05-09 15:36:58 +0000 -- done
2022-05-09 15:36:58 +0000 -- Restoring lfs objects ...
2022-05-09 15:36:58 +0000 -- done
2022-05-09 15:36:58 +0000 -- Restoring terraform states ...
2022-05-09 15:36:58 +0000 -- done
2022-05-09 15:36:58 +0000 -- Restoring container registry images ...
2022-05-09 15:36:58 +0000 -- done
2022-05-09 15:36:58 +0000 -- Restoring packages ...
2022-05-09 15:36:58 +0000 -- done
This task will now rebuild the authorized_keys file.
You will lose any data stored in the authorized_keys file.
Do you want to continue (yes/no)? yes

Deleting backups/tmp ... done
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need to restore these files manually.
Restore task is done.
Transfering ownership of /var/opt/gitlab/gitlab-rails/shared/registry to registry

image-20230322114306736

![image-20230322115131639](/Users/WinJay/Library/Application Support/typora-user-images/image-20230322115131639.png)

# 恢复成功后验证
gitlab-rake gitlab:doctor:secrets
I, [2023-03-22T11:37:51.683936 #6222]  INFO -- : Checking encrypted values in the database
I, [2023-03-22T11:38:03.266060 #6222]  INFO -- : - Ci::InstanceVariable failures: 0
I, [2023-03-22T11:38:03.298744 #6222]  INFO -- : - Ci::PipelineVariable failures: 0
I, [2023-03-22T11:38:03.332097 #6222]  INFO -- : - Ci::PipelineScheduleVariable failures: 0
I, [2023-03-22T11:38:03.364513 #6222]  INFO -- : - Ci::Variable failures: 0
I, [2023-03-22T11:38:03.396757 #6222]  INFO -- : - Ci::GroupVariable failures: 0
I, [2023-03-22T11:38:03.425674 #6222]  INFO -- : - Ci::JobVariable failures: 0
I, [2023-03-22T11:38:03.455904 #6222]  INFO -- : - ApplicationSetting failures: 0
I, [2023-03-22T11:38:03.492147 #6222]  INFO -- : - Snippet failures: 0
I, [2023-03-22T11:38:03.495460 #6222]  INFO -- : - PersonalSnippet failures: 0
I, [2023-03-22T11:38:03.498417 #6222]  INFO -- : - ProjectSnippet failures: 0
I, [2023-03-22T11:38:06.091956 #6222]  INFO -- : - User failures: 0
I, [2023-03-22T11:38:06.126600 #6222]  INFO -- : - Clusters::Platforms::Kubernetes failures: 0
I, [2023-03-22T11:38:06.161119 #6222]  INFO -- : - Integration failures: 0
I, [2023-03-22T11:38:06.164830 #6222]  INFO -- : - Integrations::Asana failures: 0
I, [2023-03-22T11:38:06.168110 #6222]  INFO -- : - Integrations::Assembla failures: 0
I, [2023-03-22T11:38:06.171846 #6222]  INFO -- : - Integrations::BaseCi failures: 0
I, [2023-03-22T11:38:06.175348 #6222]  INFO -- : - Integrations::Bamboo failures: 0
I, [2023-03-22T11:38:06.178896 #6222]  INFO -- : - Integrations::Buildkite failures: 0
I, [2023-03-22T11:38:06.182100 #6222]  INFO -- : - Integrations::DroneCi failures: 0
I, [2023-03-22T11:38:06.185532 #6222]  INFO -- : - Integrations::Jenkins failures: 0
I, [2023-03-22T11:38:06.188812 #6222]  INFO -- : - Integrations::Teamcity failures: 0
I, [2023-03-22T11:38:06.191998 #6222]  INFO -- : - Integrations::MockCi failures: 0
I, [2023-03-22T11:38:06.195683 #6222]  INFO -- : - Integrations::BaseIssueTracker failures: 0
I, [2023-03-22T11:38:06.200980 #6222]  INFO -- : - Integrations::Bugzilla failures: 0
I, [2023-03-22T11:38:06.205803 #6222]  INFO -- : - Integrations::CustomIssueTracker failures: 0
I, [2023-03-22T11:38:06.209224 #6222]  INFO -- : - Integrations::Ewm failures: 0
I, [2023-03-22T11:38:06.212429 #6222]  INFO -- : - Integrations::Jira failures: 0
I, [2023-03-22T11:38:06.216762 #6222]  INFO -- : - Integrations::Redmine failures: 0
I, [2023-03-22T11:38:06.223228 #6222]  INFO -- : - Integrations::Youtrack failures: 0
I, [2023-03-22T11:38:06.226838 #6222]  INFO -- : - Integrations::Zentao failures: 0
I, [2023-03-22T11:38:06.231877 #6222]  INFO -- : - Integrations::Campfire failures: 0
I, [2023-03-22T11:38:06.235879 #6222]  INFO -- : - Integrations::BaseThirdPartyWiki failures: 0
I, [2023-03-22T11:38:06.239868 #6222]  INFO -- : - Integrations::Confluence failures: 0
I, [2023-03-22T11:38:06.243721 #6222]  INFO -- : - Integrations::Shimo failures: 0
I, [2023-03-22T11:38:06.247549 #6222]  INFO -- : - Integrations::Datadog failures: 0
I, [2023-03-22T11:38:06.253689 #6222]  INFO -- : - Integrations::BaseChatNotification failures: 0
I, [2023-03-22T11:38:06.258511 #6222]  INFO -- : - Integrations::Discord failures: 0
I, [2023-03-22T11:38:06.262270 #6222]  INFO -- : - Integrations::HangoutsChat failures: 0
I, [2023-03-22T11:38:06.266021 #6222]  INFO -- : - Integrations::Mattermost failures: 0
I, [2023-03-22T11:38:06.269782 #6222]  INFO -- : - Integrations::MicrosoftTeams failures: 0
I, [2023-03-22T11:38:06.273701 #6222]  INFO -- : - Integrations::BaseSlackNotification failures: 0
I, [2023-03-22T11:38:06.277726 #6222]  INFO -- : - Integrations::Slack failures: 0
I, [2023-03-22T11:38:06.281570 #6222]  INFO -- : - Integrations::Pumble failures: 0
I, [2023-03-22T11:38:06.285318 #6222]  INFO -- : - Integrations::UnifyCircuit failures: 0
I, [2023-03-22T11:38:06.289161 #6222]  INFO -- : - Integrations::WebexTeams failures: 0
I, [2023-03-22T11:38:06.292913 #6222]  INFO -- : - Integrations::EmailsOnPush failures: 0
I, [2023-03-22T11:38:06.296742 #6222]  INFO -- : - Integrations::ExternalWiki failures: 0
I, [2023-03-22T11:38:06.300657 #6222]  INFO -- : - Integrations::Flowdock failures: 0
I, [2023-03-22T11:38:06.305213 #6222]  INFO -- : - Integrations::Harbor failures: 0
I, [2023-03-22T11:38:06.310763 #6222]  INFO -- : - Integrations::Irker failures: 0
I, [2023-03-22T11:38:06.315788 #6222]  INFO -- : - Integrations::BaseSlashCommands failures: 0
I, [2023-03-22T11:38:06.319880 #6222]  INFO -- : - Integrations::MattermostSlashCommands failures: 0
I, [2023-03-22T11:38:06.323736 #6222]  INFO -- : - Integrations::SlackSlashCommands failures: 0
I, [2023-03-22T11:38:06.328100 #6222]  INFO -- : - Integrations::Packagist failures: 0
I, [2023-03-22T11:38:06.333942 #6222]  INFO -- : - Integrations::PipelinesEmail failures: 0
I, [2023-03-22T11:38:06.338422 #6222]  INFO -- : - Integrations::Pivotaltracker failures: 0
I, [2023-03-22T11:38:06.343907 #6222]  INFO -- : - Integrations::BaseMonitoring failures: 0
I, [2023-03-22T11:38:06.348579 #6222]  INFO -- : - Integrations::Prometheus failures: 0
I, [2023-03-22T11:38:06.352385 #6222]  INFO -- : - Integrations::MockMonitoring failures: 0
I, [2023-03-22T11:38:06.356140 #6222]  INFO -- : - Integrations::Pushover failures: 0
I, [2023-03-22T11:38:06.388296 #6222]  INFO -- : - Clusters::Applications::Helm failures: 0
I, [2023-03-22T11:38:06.423852 #6222]  INFO -- : - Clusters::Applications::Prometheus failures: 0
I, [2023-03-22T11:38:06.463254 #6222]  INFO -- : - AlertManagement::HttpIntegration failures: 0
I, [2023-03-22T11:38:06.496388 #6222]  INFO -- : - GrafanaIntegration failures: 0
I, [2023-03-22T11:38:06.527464 #6222]  INFO -- : - JiraConnectInstallation failures: 0
I, [2023-03-22T11:38:06.558392 #6222]  INFO -- : - PagesDomain failures: 0
I, [2023-03-22T11:38:06.586917 #6222]  INFO -- : - PagesDomainAcmeOrder failures: 0
I, [2023-03-22T11:38:06.617261 #6222]  INFO -- : - ProjectImportData failures: 0
I, [2023-03-22T11:38:06.646236 #6222]  INFO -- : - RemoteMirror failures: 0
I, [2023-03-22T11:38:06.678356 #6222]  INFO -- : - WebHook failures: 0
I, [2023-03-22T11:38:06.682277 #6222]  INFO -- : - ProjectHook failures: 0
I, [2023-03-22T11:38:06.686192 #6222]  INFO -- : - ServiceHook failures: 0
I, [2023-03-22T11:38:06.689973 #6222]  INFO -- : - SystemHook failures: 0
I, [2023-03-22T11:38:06.717003 #6222]  INFO -- : - Alerting::ProjectAlertingSetting failures: 0
I, [2023-03-22T11:38:06.746098 #6222]  INFO -- : - Atlassian::Identity failures: 0
I, [2023-03-22T11:38:06.774129 #6222]  INFO -- : - BulkImports::Configuration failures: 0
I, [2023-03-22T11:38:06.803106 #6222]  INFO -- : - Clusters::KubernetesNamespace failures: 0
I, [2023-03-22T11:38:06.833392 #6222]  INFO -- : - ErrorTracking::ProjectErrorTrackingSetting failures: 0
I, [2023-03-22T11:38:06.862601 #6222]  INFO -- : - IncidentManagement::ProjectIncidentManagementSetting failures: 0
I, [2023-03-22T11:38:06.897112 #6222]  INFO -- : - Integrations::IssueTrackerData failures: 0
I, [2023-03-22T11:38:06.925338 #6222]  INFO -- : - Integrations::JiraTrackerData failures: 0
I, [2023-03-22T11:38:06.952729 #6222]  INFO -- : - Integrations::ZentaoTrackerData failures: 0
I, [2023-03-22T11:38:06.980117 #6222]  INFO -- : - Serverless::DomainCluster failures: 0
I, [2023-03-22T11:38:06.982709 #6222]  INFO -- : - Clusters::Integrations::Prometheus failures: 0
I, [2023-03-22T11:38:07.009672 #6222]  INFO -- : - Clusters::Providers::Aws failures: 0
I, [2023-03-22T11:38:07.037981 #6222]  INFO -- : - Clusters::Providers::Gcp failures: 0
I, [2023-03-22T11:38:07.066115 #6222]  INFO -- : - Packages::Debian::GroupDistributionKey failures: 0
I, [2023-03-22T11:38:07.093191 #6222]  INFO -- : - Packages::Debian::ProjectDistributionKey failures: 0
I, [2023-03-22T11:38:07.097191 #6222]  INFO -- : - Gitlab::BackgroundMigration::BackfillIntegrationsEnableSslVerification::Integration failures: 0
I, [2023-03-22T11:38:07.100397 #6222]  INFO -- : - Gitlab::BackgroundMigration::BackfillJiraTrackerDeploymentType2::JiraTrackerDataTemp failures: 0
I, [2023-03-22T11:38:07.137664 #6222]  INFO -- : - Ci::Runner failures: 0
I, [2023-03-22T11:38:07.285014 #6222]  INFO -- : - Ci::Build failures: 0
I, [2023-03-22T11:38:07.498238 #6222]  INFO -- : - Project failures: 0
I, [2023-03-22T11:38:08.232687 #6222]  INFO -- : - Group failures: 0
I, [2023-03-22T11:38:08.264085 #6222]  INFO -- : - DeployToken failures: 0
I, [2023-03-22T11:38:08.293719 #6222]  INFO -- : - Clusters::AgentToken failures: 0
I, [2023-03-22T11:38:08.375189 #6222]  INFO -- : - Operations::FeatureFlagsClient failures: 0
I, [2023-03-22T11:38:08.375283 #6222]  INFO -- : Total: 0 row(s) affected
I, [2023-03-22T11:38:08.375309 #6222]  INFO -- : Done!

image-20230322115602431

重启服务

image-20230322115733548

0
Git
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区