CentOS6.9下的lsyncd安装与配置(以本地同步为例)
2017-12-17 22:30
696 查看
lsyncd+rsync文件实时同步
0.rsync两端都需要安装 yum -y install rsync1.提供lsyncd的安装源
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm[/code] 2.yum安装lsyncd的依赖yum -y install lua lua-devel pkgconfig gcc asciidoc
3.预先解决之后步骤的报错(测试复现率100%)
Error: Cannotretrieve metalink for repository: epel. Please verify its path and try again
解决方法:vi /etc/yum.repos.d/epel.repo
编辑[epel]下的baseurl前的#号去掉,mirrorlist前添加#号。
正确的配置:[epel]name=Extra Packages for Enterprise Linux 6 - $basearchbaseurl=http://download.fedoraproject.org/pub/epel/6/$basearch#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
4.yum安装lsyncdyum install lsyncd
5.为日志文件创建目录(很可能是已经存在的目录)mkdir /var/log/lsyncd编写配置文件
1.VI编辑配置文件vi /etc/lsyncd.conf
2.配置文件的最简写法(远程同步)[root@iZ230xvongqZ ~]# cat /etc/lsyncd.conf# vi etc/lsyncd.confsettings {logfile ="/var/log/lsyncd/lsyncd.log",statusFile ="/var/log/lsyncd/lsyncd.status",inotifyMode = "CloseWrite or Modify",maxProcesses = 8,-- nodaemon = true,}sync {default.rsync,source = "/data/home/wwwroot/default",target = "xxx.xxx.xxx.xxx:/data/home/wwwroot/default",delay = 0,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,rsh = "/usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no"}}sync {default.rsync,source = "/home/wwwroot/jifen",target = "xxx.xxx.xxx.xxx:/home/wwwroot/jifen",delay = 0,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,rsh = "/usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no"}}sync {default.rsync,source = "/data/home/wwwroot/default",target = "xx.xx.xx.xx:/data/home/wwwroot/default",delay = 0,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"}}sync {default.rsync,source = "/home/wwwroot/jifen",target = "xx.xx.xx.xx:/home/wwwroot/jifen",delay = 0,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"}}[root@iZ230xvongqZ ~]#需要设置更多同步参数在此基础上扩展配置文件即可
同步更多目录可以直接复制sync块
应注意每行后面的逗号不要漏写启动Lsyncd服务
1.开启lsyncd服务/etc/init.d/lsyncd start2.显示服务运行状态/etc/init.d/lsyncd status
3.设置lsyncd服务自启动chkconfig lsyncd on参考
lsyncd在centos和Ubuntu下的安装配置方法
https://www.scalescale.com/tips/nginx/lsyncd-live-file-syncronization-linux/
官方文档对配置文件中Settings部分的解释
https://github.com/axkibe/lsyncd/wiki/Lsyncd-2.1.x-%E2%80%96-The-Configuration-File
官方文档对配置文件中sync部分的解释
https://github.com/axkibe/lsyncd/wiki/Lsyncd%202.1.x%20%E2%80%96%20Layer%204%20Config%20%E2%80%96%20Default%20Behavior
一篇中文文章,在安装和配置上给了我很多帮助
https://linux.cn/article-5849-1.html
相关文章推荐
- CentOS6.1下的lsyncd安装与配置(以本地同步为例)
- centos安装svn并配置钩子同步到www目录
- 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——安装配置NTP服务,保证集群时间保持同步
- 王高利:CentOS6.5下redis安装部署配置指南、常用命令、主从同步集群、redis-php学习资料整合详解
- CentOS6.9下svn快速安装配置方法
- CentOS6.5下redis安装部署配置指南、常用命令、主从同步集群、redis-php学习资料整合详解
- CentOS安装和配置Rsync进行文件同步
- centos上 安装配置svnserve服务器与同步到web网站目录
- CentOS6.9下mysql 5.7.17安装配置方法图文教程
- CentOS下安装配置SVN服务器并自动同步到web目录
- centos下同步备份工具rsync的安装及配置
- Centos 6.7 本地yum源配置及MongoDB安装
- CentOS7 下安装和配置本地用户登录VSFTP服务器
- CentOS7 下安装和配置本地用户登录VSFTP服务器
- 基于 CentOS Mysql 安装与主从同步配置详解
- CentOS6.9下NFS服务安装配置教程
- 安装和配置CentOS时钟同步服务
- CentOS 本地iso挂载并配置iso镜像作为yum源安装软件
- CentOS 6.9下配置安装KVM
- CentOS 6.8 ftp服务安装配置 基于本地用户和虚拟用户