Migration Environment Preparation:
Gitlab data migration needs to be done between the same version. Because of the different versions of Gitlab, the database table structure and the way the program is implemented are different. If you need to migrate Gitlab data from Server A to Server B, Server B needs to deploy the same version of Gitlab as Server A.
Migration Implementation Mode:
You can use the Gitlab backup and restore command to implement data migration.
Backup:
Bundle EXEC Rake Gitlab:backup:create rails_env=production
The backup command backs up the warehouse and MySQL data for all projects in the local Gitlab.
Recovery:
Bundle EXEC Rake Gitlab:backup:restore rails_env=production backup=timestamp
The restore command imports the MySQL data from the backup and the Project repository directory, and can refactor the ~/.ssh/authorized_keys authentication file from the data in the MySQL library as needed.
Migration operations:
Server A:
#su-GIT$CD gitlab$ bundle exec Rake gitlab:backup:create rails_env=production
If run error-free, after the backup succeeds, a backup tar package is generated under the backup directory (default =/home/git/gitlab/tmp/backups), which contains the Gitlab project repository and MySQL export data.
File formats such as: 1449731757_gitlab_backup.tar, where "1449731757" is the timestamp of the backup file.
Upload the backup file to Server B's backup directory.
Server B:
#chown GIT.GIT/HOME/GIT/GITLAB/TMP/BACKUPS/1449731757_GITLAB_BACKUP.TAR#SU-GIT$CD gitlab$ Bundle exec Rake Gitlab: Backup:restore rails_env=production backup=1449731757
Note here the "backup=1449731757", where you need to fill in the time stamp to recover the file.
If it runs correctly, the data migration is complete.
Note: The default backup directory for Gitlab can be modified in/HOME/GIT/GITLAB/CONFIG/GITLAB.YML:
$vi/home/git/gitlab/config/gitlab.yml backup:path: "Tmp/backups"
This article is from the Linux OPS blog, so be sure to keep this source http://icenycmh.blog.51cto.com/4077647/1723296
Gitlab Data Migration