rsync+crontab realizes regular backup gitlab

The environmental basic reference is as follows (be sure to read the following article, the two are related)

surroundings
  • CentOS Linux release 7.5.1804 (Core)
    close the firewall and selinux
    192.168.153.179 master
    192.168.153.178 backup

Start deployment

  • master operation

Binary install gitlab

[root@server ~]# ls
gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm
[root@server ~]# yum -y install gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm 

Change to gitlab host IP

vim /etc/gitlab/gitlab.rb

Insert picture description here
Reconfigure and start gitlab

gitlab-ctl reconfigure

Log in to our gitlab and create groups and projects, then add a file
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Modify and restart rsync

[root@server ~]# vim /etc/rsyncd.conf 
[root@server ~]# pkill rsync
[root@server ~]# rsync --daemon

Insert picture description here
Execute the backup command: This command will back up the gitlab warehouse, database, users, user groups, user keys, permissions and other information.

gitlab-rake gitlab:backup:create

The following data will appear on our master side after backup
Insert picture description here

  • Backup operation
    data added successfully
    Insert picture description here

Soul torture?

  • So how can I recover the data loss of my gitlab server? ? ?

Give pointers!

  • Through the gitlab backup file, all the information of gitlab can be restored, including information such as warehouse, database, user, user group, user key, authority and so on.

Start operation

We enter the server gitlab page and delete a.txt
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

  • master command line operation
  • 1. Stop related data connection services
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Insert picture description here

  • 2. Restore the gitlab warehouse.
    Now we need to restore the data from the backup label "1604020090_2020_10_30_10.0.2". The command is as follows: (if you need to enter yes/no in the middle) I believe you should know how to enter
gitlab-rake gitlab:backup:restore BACKUP=1604020090_2020_10_30_10.0.2
  • 3. Start the gitlab service
gitlab-ctl start

After that, we log in to our gitlab warehouse to check (502 may appear) Don’t panic, just wait patiently for the refresh

Insert picture description here
Insert picture description here
At this point, our task is completed
1. Back up gitlab data to the backup end
2. Learn how to restore gitlab data through the backup number

~ _ ~ Come on! ! !

Guess you like

Origin blog.csdn.net/qq_49296785/article/details/109361760