gitlab achieve standby switching cluster

History: gitlab-ce does not support distributed architecture program, so all in one service down, the service can not be quickly restored

rsync + PostgreSQL backup way to achieve fast switching server ip pseudo availability

Host List
192.168.102.7 gitlab-Master
192.168.102.7 gitlab-Backup

1, gitlab build environment (from the same master)

#wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.6.5-ce.0.el7.x86_64.rpm
#rpm -ivh gitlab-ce-11.6.5-ce.0.el7.x86_64.rpm
#gitlab-ctl reconfigure
#gitlab-ctl restart

2, rsync synchronize the repo (192.168.102.7)
# SSH-keygen
# SSH-Copy-ID -i .ssh / id_rsa.pub 192.168.102.8
# /. 5 * the rsync -av / var / opt / gitlab / Git-Data / Repositories 192.168.102.8:/var/opt/gitlab/git-data/ ## here is the default repo address

3, create test data (192.168.102.7)
gitlab achieve standby switching cluster

We created here a repo of test1

4, the backup database (192.168.102.7)
#su - gitlab the psql-
#pg_dump -C -f gitlabhq_production.sql gitlabhq_production
#scp gitlabhq_production.sql 192.168.102.8:/root

5, restore the database (192.168.102.8)
#su - gitlab the psql-
#psql -H / var / opt / gitlab / PostgreSQL -d -f gitlabhq_production.sql gitlabhq_production

6, the data from node to verify consistency
gitlab achieve standby switching cluster

This test is completed, in order to restore this way, do not need to bring their own tools gitlab-rake recovery, you can quickly restore service gitlab

Guess you like

Origin blog.51cto.com/chentianwang/2413926