使用rsync 实现程序上线部署

rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。

安装非常简单

yum install rsync 即可

需要接收文件的服务器做配置

vi /etc/rsyncd.conf

uid=www-data
gid=www-data
max connections=36000
use chroot=yes
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
 
[abc]
path=/data/web/
ignore errors = yes
read only = no
hosts allow =  *  #这里指定允许同步的服务器IP

服务器端启动

rsync --daemon --config=/etc/rsyncd.conf

客户端需要向服务器同步文件的时候运行

 

rsync -az --delete --exclude-from=/path/to/exclude /data [email protected]::abc

将/data 目录同步到服务器1.100上[abc]的配置文件中path目录下 执行忽略 exclude 中的文件

 

0

猜你喜欢

转载自soledede.iteye.com/blog/1999000