gitlab實現主備切換集羣

歷史:gitlab-ce是不支持分佈式架構方案的,因此all in one的服務down後,服務沒法迅速恢復git

rsync+PostgreSQL備份的方式實現快速切換server ip實現僞高可用sql

主機列表
192.168.102.7 gitlab-master
192.168.102.7 gitlab-backup數據庫

1,搭建gitlab環境(主從同樣)架構

#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 restartssh

2,rsync同步repo(192.168.102.7)
#ssh-keygen
#ssh-copy-id -i .ssh/id_rsa.pub 192.168.102.8
#/5 * rsync -av /var/opt/gitlab/git-data/repositories 192.168.102.8:/var/opt/gitlab/git-data/ ##這裏是默認的repo地址分佈式

3,建立測試數據(192.168.102.7)
gitlab實現主備切換集羣ide

這裏建立了一個test1的repo工具

4,備份數據庫(192.168.102.7)
#su - gitlab-psql
#pg_dump -c –f gitlabhq_production.sql gitlabhq_production
#scp gitlabhq_production.sql 192.168.102.8:/rootgitlab

5,恢復數據庫(192.168.102.8)
#su - gitlab-psql
#psql -h /var/opt/gitlab/postgresql -d gitlabhq_production -f gitlabhq_production.sqlpost

6,驗證從節點數據是否一致
gitlab實現主備切換集羣

到此測試完成,以這種方式的恢復,不須要gitlab-rake自帶工具恢復,能夠快速恢復gitlab的服務

相關文章
相關標籤/搜索