rsync 同步多台服务器项目目录
server1:192.168.10.1
server2:192.168.10.2
实现server2实时同步server1的数据!
###############server1###############
1.安装rsync和xinetd,并创建目录:
yum install rsync xinetd
mkdir -p /home/rsync/
mkdir -p /home/rsync/log/
mkdir -p /home/rsync/pid/
mkdir -p /home/rsync/run/
2.配置xinetd:
vi /etc/xinetd.d/rsync
#disable = yes修改为
disable = no
3.启动xinetd服务:
service xinetd start
4.编辑rsyncd.conf配置文件:
vim /etc/rsyncd.conf
uid = root
gid = root
port=873
use chroot = no
read only = no
list = no
max connections = 0
timeout = 600
log file = /home/rsync/log/rsyncd.log
pidfile = /home/rsync/pid/rsyncd.pid
lock file = /home/rsync/run/rsync.lock
[rsync]
path = /alidata/www/xu/
comment = rsync
ignore errors
auth users = rsync
secrets file = /home/rsync/rsync.pass
hosts allow = 192.168.10.2
hosts deny = *
5.创建用户认证文件:
vim /home/rsync/rsync.pass
ruanqin/ruanqin
6.设置文件权限:
chmod 600 /home/rsync/rsyncd.conf
chmod 600 /home/rsync/rsync.pass
7.配置rsyncd.conf软链接:
ln -s /home/rsync/rsyncd.conf /etc/rsyncd.conf
8.重启xinetd服务:
service xinetd restart
###############server2###############
1.安装rsync和xinetd,并创建目录:
yum install rsync xinetd
mkdir -p /home/rsync/
mkdir -p /home/rsync/log/
mkdir -p /home/rsync/pid/
mkdir -p /home/rsync/run/
2.配置xinetd:
vi /etc/xinetd.d/rsync
#disable = yes修改为
disable = no
3.启动xinetd服务:
service xinetd start
4.创建认证密码文件:
vi /home/rsync/passwd.txt
ruanqin
5.执行同步脚本:
6.
7.任务计划每分钟执行一次:
crontab -e
*/1 * * * * /usr/bin/rsync -vzrtopg --progress --delete --password-file=/home/rsync/passwd.txt rsync@192.168.10.1::rsync /home/www/html
rsync 同步多台服务器项目目录的更多相关文章
- rsync配置两台服务器之间的文件备份(同步)
rsync配置两台服务器之间的文件备份(同步) 前情提要 环境: 192.168.1.2 主服务器 centos 7.7 192.168.1.3 备份服务器 centos 7.7 rsync 安装(两 ...
- Centos 6.5 rsync+inotify 两台服务器文件实时同步
rsync和inotify是什么我这里就不在介绍了,有专门的文章介绍这两个工具. 1.两台服务器IP地址分别为: 源服务器:192.168.1.2 目标服务器:192.168.1.3 @todo:从源 ...
- Centos7 rsync+inotify两台服务器同步文件(单向)
注:本篇介绍的是单向同步,即A文件同步到B,但B的文件不同步到A,双向同步的在下一篇文章中. rsync与inotify不再赘述,直接进入实战. 0.背景 两台服务器IP地址分别为: 源服务器:192 ...
- 使用rsync+inotify同步两台服务器文件
目标功能:将B服务器文件同步到A服务器 A服务器rsyncd.conf配置 权限600 A服务器rsyncd.pas文件配置 权限600 同步文件路径 /data/wwwroot/shen/ 权限 ...
- 用 rsync 同步本地和服务器的文件
参考 DigitalOcean 安装 For Debian/Ubuntu: sudo apt-get install rsync For OpenSUSE/Fedora: sudo yum insta ...
- 使用rsync实现不同Linux服务器间目录同步
实现目标: A 服务器上 /opt/web 目录,与B服务器上 /opt/web目录实现同步.即:B主动与A进行同步. OS: Reaht AS4 A Server 192.168.1 ...
- git同步开发更新至项目目录(转载)
From:http://toroid.org/ams/git-website-howto 本地版本库中存放开发的项目代码.以下内容介绍如何将本地版本库修改通过执行“git push web”命令同步到 ...
- CentOS5.x、CentOS6.x 使用NFS及mount实现两台服务器间目录共享
一.环境介绍: 服务器:centos 192.168.1.225 客户端:centos 192.168.1.226 二.安装: NFS的安装配置:centos 5 : portmap:实现RPC(协议 ...
- rsync同步本地和服务器之间的文件
同步本地文件到服务器 rsync -zvrtopg --progress --delete test -e 'ssh -p 6665' yueyao@172.16.0.99:/media/sdb/us ...
随机推荐
- 【POJ 2152】 Fire
[题目链接] 点击打开链接 [算法] 同样是树形DP,但是比较难,笔者做这题看了题解 令f[i][j]表示在以i为根的子树中 1.在以i为根的子树中建一些消防站 2.在节点j必须建一个消防站 3.以i ...
- [九省联考2018]一双木棋chess——搜索+哈希
题目:bzoj5248 https://www.lydsy.com/JudgeOnline/problem.php?id=5248 洛谷P4363 https://www.luogu.org/prob ...
- 【179】IDL 读写 NetCDF 文件
NetCDF(network Common Data Form)由位于科罗拉多州波尔市的 Unidata 程序中心开发,主要应用于大气科学的研究.NetCDF 的数据模式具有简单性和灵活性的特点.Ne ...
- ASP.NET验证控件CustomValidator客户端验证DropDownList、TextBox
<asp:DropDownList ID="ddlTown" runat="server"> <asp:ListItem Value=&quo ...
- 极简版OKEX比特币跨期对冲策略
策略特点 只做正套,反套可以修改下,合约调换一下,即是反套. 添加两个 交易所对象,第一个季度,第二个当周. 精简了所有能简化的代码,优化空间还很大,教学策略谨慎实盘,跨期有一定风险. 欢迎反馈BUG ...
- shiro之SimpleAccountRealm
我使用的是maven构建的工程,junit测试 Shiro认证过程 创建SecurityManager--->主体提交认证--->SecurityManager认证--->Authe ...
- iOS 切割圆角图片、图片文件格式判断
1.切割圆角图片 // 性能不好,适合圆角图形数量比较少的情况 UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMak ...
- Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
myeclipse 新建web项目,报错Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger,查看项目中已经有引入了 ...
- 简单的AndroidStudio单元测试工程配置
转载: http://www.jianshu.com/p/03118c11c199
- L - Prime Number(求n内质数的个数)
Description Write a program which reads an integer n and prints the number of prime numbers which ar ...