在CentOS上对GitLab进行备份和恢复是一个重要的任务,以确保数据的安全性和业务的连续性。以下是详细的步骤:
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo yum install gitlab-ce-版本号.rpm
/etc/gitlab/gitlab.rb
文件,设置备份路径和其他相关配置。gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_archive_permissions'] = 0644
gitlab_rails['backup_keep_time'] = 7776000 # 备份保留天数,秒计算
sudo gitlab-ctl reconfigure
sudo gitlab-rake gitlab:backup:create
crontab -e
添加定时任务,例如每天凌晨2点执行备份:0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
/var/opt/gitlab/backups
目录。sudo gitlab-rake gitlab:backup:restore BACKUP=备份编号
sudo gitlab-rake gitlab:backup:restore BACKUP=1577383292_2019_12_27_12.3.0
sudo gitlab-ctl start
以上步骤涵盖了在CentOS上对GitLab进行备份和恢复的基本流程。请根据实际情况调整配置和路径。