Rsync+Notify NFS

Rsync+Notify:

yum install make gcc gcc-c++

客户端启动rsync port:873
/usr/local/rsync/bin/rsync --daemon --config=/usr/local/rsync/rsync.conf

Client:
tar xf rsync-3.0.9.tar.gz
cd rsync-3.0.9
./configure --prefix=/usr/local/rsync/
make && make install

rsync.conf 客户端配置
vi /usr/local/rsync/rsync.conf
uid = root
gid = root
use chroot = no
max connections = 10
strict modes = yes
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[xxx-xxx]
path = /path/to/file/
comment = xxxx
ignore errors
read only = no
write only = no
hosts allow = 192.168.1.100
hosts deny = *
list = false
uid = root
gid = root
auth users=xxx-user
secrets file = /usr/local/rsync/rsync.passwd

vi /usr/local/rsync/rsync.passwd
pwdpwdpwd

/usr/local/rsync/bin/rsync --daemon --config=/usr/local/rsync/rsync.conf
iptables -I INPUT 7 -p tcp --dport 873 -j ACCEPT

 

Server:
iptables -I INPUT 7 -p tcp --dport 873 -j ACCEPT

tar xf rsync-3.0.9.tar.gz
cd rsync-3.0.9
./configure --prefix=/usr/local/rsync/
make && make install

tar xf inotify-tools-3.14.tar.gz
cd inotify-tools-3.14
./configure --prefix=/usr/local/inotify
make && make install


rsync服务端配置
vi /usr/local/rsync/rsync.passwd
pwdpwdpwd


vi /usr/local/rsync/rsync.sh
#!/bin/bash
#
host=192.168.1.101
src=/path/to/file/
des=xxxx
user=xxx-user


/usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src | while read files
do
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/usr/local/rsync/rsync.passwd $src $user@$host::$des


echo "${files} was rsynced" >>/var/log/rsync.log 2>&1
done

 

nohup sh /usr/local/rsync/rsync.sh &
tail -f nohup.out
tail -f /var/log/rsync.log

 

 

 

 NFS:

Master:
yum install epel-release
yum repolist
yum makecache fast

yum install -y nfs-utils rpcbind
systemctl start rpcbind
systemctl start nfs
systemctl enable nfs
systemctl enable rpcbind

vi /etc/exports
/others/aisd 192.168.1.0/24(rw,no_root_squash,sync)

systemctl restart nfs
iptables -I INPUT 5 -s 192.168.1.101 -j ACCEPT


Salve:
yum install epel-release
yum repolist
yum makecache fast

yum install -y nfs-utils rpcbind
systemctl start rpcbind
systemctl start nfs
systemctl enable nfs
systemctl enable rpcbind
iptables -I INPUT 5 -s 192.168.1.100 -j ACCEPT

mkdir /others/aisd/
mount 192.168.1.100:/others/aisd/ others/aisd/

解绑:umount -l /others/aisd/

vi /etc/fatab
192.168.1.100:/others/aisd/ /others/aisd/ nfs defaults 0 0

mount -a
df -h

 

posted @   walkersss  阅读(68)  评论(0编辑  收藏  举报
编辑推荐:
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· DeepSeek “源神”启动!「GitHub 热点速览」
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
历史上的今天:
2020-06-11 Dell PowerEdge R710, R720 用U盘装系统
2020-06-11 DELL R720 加内存条
点击右上角即可分享
微信分享提示