栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

gitlab同步复制repo以及数据库

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

gitlab同步复制repo以及数据库

gitlab主从复制

同步复制repo、数据库信息;


这么做的原因:

A、为什么不使用lsyncd同步pg,因为尝试之后,gitlab 502,所以分开,pg数据很少去更新;

B、为什么不pg主从,因为pg从库的权限是只读的,gitlab登录是update sql,所以无法登录,故而不做pg主从;

步骤 1、主库安装lsyncd

下载地址:
http://www.rpmfind.net/linux/rpm2html/search.php?query=lsyncd

# download
wget http://www.rpmfind.net/linux/epel/7/x86_64/Packages/l/lsyncd-2.2.2-1.el7.x86_64.rpm
# install
rpm -ivh lsyncd-2.2.2-1.el7.x86_64.rpm
2、设置lsyncd.conf

配置lsyncd配置信息

----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync, but executing moves through on the target.
--
-- For more examples, see /usr/share/doc/lsyncd*/examples/
-- 
-- sync{default.rsyncssh, source="/var/www/html", host="localhost", targetdir="/tmp/htmlcopy/"}

settings {
    logfile ="/var/log/lsyncd/lsyncd.log",
    statusFile ="/var/log/lsyncd/lsyncd.status",
    inotifyMode = "CloseWrite",
    maxProcesses = 8,
    }


-- 远程本地gitlab目录同步到备库,rsync+ssh
sync {
    default.rsync,
    source    = "/var/opt/gitlab/",
    target    = "root@slaveIP:/var/opt/gitlab/",
    -- 上面target,注意如果是普通用户,必须拥有写权限
    -- 排除选项
    exclude = { "backups" ,"gitlab-ci", "sockets", "gitlab.yml", "redis", "postmaster.pid","recovery.conf","postgresql.conf","pg_hba.conf","postgresql10 * * * * /usr/bin/sh /opt/pg_syncd.sh
4、启动lsyncd

切记不可设置为自启动,避免主从切换数据错乱

# lsyncd,切记不可设置为自启动,避免主从切换数据错乱
systemctl start lsyncd
5、验证

主:

从:

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/887116.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号