赞
踩
任意一个Gitlab实例中的项目都能通过导出成文件然后导入到新Gitlab的方式来完成迁移。
优点:
缺点:
Gitlab 的v13.0之前,只能在兼容版本的Gitlab之间实现导入导出,例如Gitlab v12.10导出的项目只能导入到版本号为v11.70到v12.10的Gitlab,具体参考:
从GitLab 13.0开始,GitLab可以导入从不同的GitLab部署中导出的包,仅限于之前的两个GitLab小版本,例如:
在项目导出时,不是所有的数据都会被导出,有一部分数据并不会导出,具体参考:
The following items are exported:
The following items are not exported:
These content rules also apply to creating projects from templates on the group or instance levels, because the same export and import mechanisms are used.
根据官方文档说,单个gitlab之间数据的迁移,这是最推荐的方式。
优点:
缺点:
GitLab provides a command line interface to back up your entire instance, including:
Backups do not include:
# Install gitlab by using the Omnibus package
## Gitlab 12.2 or later
sudo gitlab-backup create
## Gitlab 12.1 and earlier
sudo gitlab-rake gitlab:backup:create
# Install gitlab from source
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
The backup Rake task GitLab provides does not store your configuration files. The primary reason for this is that your database contains items including encrypted information for two-factor authentication and the CI/CD secure variables. Storing encrypted information in the same location as its key defeats the purpose of using encryption in the first place.
For Omnibus:
For installation from source:
具体参考
The command line tool GitLab provides to backup your instance can accept more options.
## For Omnibus GitLab packages
sudo gitlab-backup create STRATEGY=copy
## For installations from source
sudo -u git -H bundle exec rake gitlab:backup:create STRATEGY=copy RAILS_ENV=production
You can exclude specific directories from the backup by adding the environment variable SKIP, whose values are a comma-separated list of the following options:
# skip db and uploads
## For Omnibus GitLab packages
sudo gitlab-backup create SKIP=db,uploads
## For installations from source
sudo -u git -H bundle exec rake gitlab:backup:create SKIP=db,uploads RAILS_ENV=production
Disabling prompts during restore GITLAB_ASSUME_YES=1
Back up Git repositories concurrently
GITLAB_BACKUP_MAX_CONCURRENCY: The maximum number of projects to back up at the same time. Defaults to the number of logical CPUs (in GitLab 14.1 and earlier, defaults to 1).
GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY: The maximum number of projects to back up at the same time on each storage. This allows the repository backups to be spread across storages. Defaults to 2 (in GitLab 14.1 and earlier, defaults to 1).
Incremental repository backups INCREMENTAL=yes PREVIOUS_BACKUP=<timestamp_of_backup>
Introduced in GitLab 14.9 with a flag named incremental_repository_backup. Disabled by default
PREVIOUS_BACKUP option introduced in GitLab 15.0
Back up specific repository storages REPOSITORIES_STORAGES=<storage1,…,storageN>
Uploading backups to a remote (cloud) storage
# Restore for installation from source
## Stop processes that are connected to the database
sudo service gitlab stop
## restore
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
参考:
Back up and restore GitLab | GitLab
通过git的方式来实现数据的迁移,是一种非常简单且机械的方式,不用考虑多到单,单到单、全量迁移、增量迁移等种种问题,通过git clone Gitlab-A / Gitlab-B 等到本地,然后git push到Gitlab-new
有增量的数据,可以pull拉取最新的代码,然后push到新Gitlab,以此来实现增量的更新;
缺点:
Rake tasks are available to import bare repositories into a GitLab instance. When migrating from an existing GitLab instance, and to preserve ownership by users and their namespaces, please use our project-based import/export. 也就是使用方式一。
注意事项:
[Congregate]地址:https://gitlab.com/gitlab-org/professional-services-automation/tools/migration/congregate/-/tree/master
Congregate is a migration tool that can move data from many different Source Code Management (SCM) and Continuous Integration (CI) systems into a GitLab Self Managed (SM) instance hosted in the customer data center/cloud or GitLab.com. It is what GitLab Professional Services uses for large scale migration engagements. It is being shared in a source-available way for collaboration with Customers and Partners.
快速启动参考:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。