Gitlab service migration and gitlab administrator password retrieval

service migration

1. Backup the original server data

gitlab-rake gitlab:backup:create RAILS_ENV=production

2. The backups, which are generally located in /var/opt/gitlab/, automatically generate filenames such as 1595350598_2020_07_22_10.0.0_gitlab_backup.tar

Note : due to Gitlab’s own compatibility issues, the higher version of Gitlab cannot recover the data backed up by the lower version. Note that you need to deploy the same version of Gitlab

on server b as on server a
3. After backups, copy the tar file that was just generated to the corresponding directory on the new server:

4. Restore data on new server

gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1595350598_2020_07_22_10.0.0

BACKUP time point must be consistent with the original server BACKUP after the file name

administrator password forced retrieval

1. Connect to the server installed by gitlab via xshell

2. Enter the gitlab-rails console production into the gitlab console. Only after entering the console can you enter the gitlab query statement and it will be parsed

gitlab-rails console production

3. Enter user = user.where (id:1). First query the user object with id 1, because the default for super admin users is 1

user = User.where(id:1).first

4. Enter user.password= ‘password’ and fill in your new password position to

user.password='密码'

5. Then enter user.save! Save the user object

user.save

Log in to the login page to test

Read More: