In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this "GitLab data backup, recovery and upgrade method" article, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "GitLab data backup, recovery and upgrade method" article.
I. data backup
Open the / etc/gitlab/gitlab.rb configuration file first and view a configuration item related to backup:
Gitlab_rails ['backup_path'] = "/ var/opt/gitlab/backups"
This item defines the path to the default backup file, which can take effect by modifying the configuration and executing the gitlab-ctl restart restart service. Backup can be done by executing a command: / opt/gitlab/bin/gitlab-rake gitlab:backup:create, or you can add it to crontab for regular execution:
0 2 * / opt/gitlab/bin/gitlab-rake gitlab:backup:create
You can find the backup package at / var/opt/gitlab/backups, decompress and check, and you will find that the backup is relatively comprehensive, and the classification of database, repositories, build, upload and so on is relatively clear.
If you perform a backup every day, there must be a risk that the directory will be full. We can immediately think of finding files before a certain period of time through find and deleting them with rm. However, there is no need to bother. Gitlab-ce itself integrates with automatic deletion configuration. Also open the / etc/gitlab/gitlab.rb configuration file and you can find the following configuration:
Gitlab_rails ['backup_keep_time'] = 604800
Here, you set the backup to be kept for 7 days (73600240604800) in seconds. If you want to increase or decrease, you can directly configure it here and restart the service via gitlab-ctl restart.
II. Data recovery
You need to stop the data connection service before recovery:
Gitlab-ctl stop unicorngitlab-ctl stop sidekiq
If it is an empty mainframe, there is no operation, in theory, these two services can also be used. The purpose of stopping these two services is to ensure data consistency. If you have not modified the default backup directory, copy the backup files from the old server / var/opt/gitlab/backups directory to / var/opt/gitlab/backups on the new server, and execute the following command to restore:
Gitlab-rake gitlab:backup:restore BACKUP= backup number
In the previous picture, it was more intuitive:
In the above operation, there are two points to note:
1. Which one is the backup number? -_ gitlab is all the previous parts
2. 600 permissions are not allowed to be restored. -it's changed to 777.
Type the yes twice later and the recovery is complete.
After the recovery is complete, start the two services just now, or restart all the services, and then open the browser for access, and find that the data is the same as the previous one:
Gitlab-ctl start unicorngitlab-ctl start sidekiq or gitlab-ctl restart
It is also important to note that according to past experience, restoring gitlab from backup files must ensure that the gitlab versions of the two hosts are the same, otherwise it will prompt that the versions do not match.
III. Gitlab-ce upgrade
Upgrade is relatively simple, but it is best not to span too large versions, when the version difference is relatively large, it is best to upgrade one version at a time.
# turn off gitlab service gitlab-ctl stop unicorngitlab-ctl stop sidekiqgitlab-ctl stop nginx# backup gitlabgitlab-rake gitlab:backup:create# upgrade rpm package rpm-Uvh gitlab-ce-xxx.rpm# start and view gitlab version information gitlab-ctl reconfiguregitlab-ctl restarthead-1 / opt/gitlab/version-manifest.txt
Possible error report
Error executing action `run` on resource 'ruby_ block[ directory resource: / var/opt/gitlab/git-data/repositories]' solution: the above sudo chmod 2770 / var/opt/gitlab/git-data/repositories is about "data backup, recovery and upgrade methods of GitLab". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to learn more about related knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.