部署rsync和gitlab

部署rsync+inotify和gitlab


1.部署rsync+inotify同步/runtime目录至目标服务器的/liucong/下。即把/runtime目录同步至目标服务器的/liucong/下。

配置时钟同步,将源服务器当作时钟服务器
源服务器:
[root@10 ~]# vim /etc/chrony.conf
 25 # Serve time even if not synchronized to a time source.
 26 local stratum 10
[root@10 ~]# systemctl restart chronyd
[root@10 ~]# systemctl enable chronyd
[root@10 ~]# hwclock -w
[root@10 ~]#

目标服务器:
[root@20 ~]# vim /etc/chrony.conf
server 192.168.89.10 iburst
[root@20 ~]# systemctl restart chronyd
[root@20 ~]# systemctl restart chronyd
[root@20 ~]# systemctl enable chronyd
[root@20 ~]# hwclock -w
[root@20 ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* time.cloudflare.com           3   6    17    11  +9191ns[-2551ms] +/-  100ms
^- tock.ntp.infomaniak.ch        1   6    17    10    -30ms[  -30ms] +/-  151ms
^? ntp.wdc1.us.leaseweb.net      0   7     0     -     +0ns[   +0ns] +/-    0ns
^- ntp8.flashdance.cx            2   7   301     2  +7672us[+7672us] +/-  186ms
^? 192.168.89.10                 0   7     0     -     +0ns[   +0ns] +/-    0ns

//关闭防火墙与SELINUX
[root@20 ~]# systemctl stop firewalld
[root@20 ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@20 ~]# setenforce 0
[root@20 ~]# sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/sysconfig/selinux
[root@20 ~]# yum -y install rsync    //安装rsync服务端软件
[root@20 ~]# mkdir /liucong/


[root@20 ~]# vim /etc/rsyncd.conf   //设置rsyncd.conf配置文件
log file = /var/log/rsyncd.log    # 日志文件位置,启动rsync后自动产生这个文件,无需提前创建
pidfile = /var/run/rsyncd.pid     # pid文件的存放位置
lock file = /var/run/rsync.lock   # 支持max connections参数的锁文件
secrets file = /etc/rsync.pass    # 用户认证配置文件,里面保存用户名称和密码,必须手动创建这个文件

[etc_from_client]     # 自定义同步名称
path = /liucong/          # rsync服务端数据存放路径,客户端的数据将同步至此目录
comment = sync etc from client
uid = root        # 设置rsync运行权限为root
gid = root        # 设置rsync运行权限为root
port = 873        # 默认端口
ignore errors     # 表示出现错误忽略错误
use chroot = no       # 默认为true,修改为no,增加对目录文件软连接的备份
read only = no    # 设置rsync服务端为读写权限
list = no     # 不显示rsync服务端资源列表
max connections = 200     # 最大连接数
tim
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值