- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
摘要: 192.168.30.178 目标服务器(相当于备份服务器)192.168.30.160 源服务器一、目标服务器(192.168.30.178)上的设置:开启防火墙tcp873rsync默认的端口vim /etc/sysconfig/iptables-A INPUT -m state --state NEW - ...
192.168.30.178 目标服务器(相当于备份服务器)
192.168.30.160 源服务器
一、目标服务器(192.168.30.178)上的设置:
开启防火墙tcp873rsync默认的端口
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
service iptables restart
安装rsync软件:
yum install rsync xinetd -y
vim /etc/xinetd.d/rsync #####设置开机自启动 把disable=yes ,改成no
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
添加新用户和组并赋给相应的权限:
groupadd rsync
useradd rsync
mkdir /home/rsync/backup/
chown rsync:rsync /homersync/backup/
创建rsync daemon的配置文件
vim /etc/rsyncd.conf
=================================================
uid = rsync ||
gid = rsync ||
use chroot = no ||
max connections = 40 ||
timeout = 300 ||
pid file = /var/run/rsyncd.pid ||
lock file = /var/run/rsyncd.lock ||
log file = /home/rsync/backup/rsyncd.log ||
[backup] ||
path = /home/rsync/backup/ ||
ignore errors ||
read only = false ||
list = false ||
hosts allow = 192.168.30.0/24 ||
auth users = rsync ||
secrets file =/etc/rsync.password ||
====================================
创建密码文件
[root@GJB-UAT ~]# vim /etc/rsync.password
====================
rsync:vhost$1 ||
====================
启动xinted服务
/etc/init.d/xinted start
[root@GJB-UAT ~]# chmod 600 /etc/rsync.password
[root@GJB-UAT ~]# chmod 600 /etc/rsyncd.conf
二、源服务器(192.168.30.160)安装rsync和inotify(监听作用)
开启防火墙tcp873rsync默认的端口
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
service iptables restart
安装rsync软件:
yum install rsync xinetd -y
vim /etc/xinetd.d/rsync #####设置开机自启动 把disable=yes ,改成no
============================================
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
# allows crc checksumming etc.
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
=====================================
启动xinted服务
/etc/init.d/xinetd start
正在启动 xinetd: [确定]
查看监听端口:
netstat -lntp|grep xinetd
tcp 0 0 :::873 :::* LISTEN 38518/xinetd
创建认证文件
vim /etc/rsyncd.passwd
vhost$1
[root@Monitor conf]# chmod 600 /etc/rsyncd.passwd
此步骤测试rsync能否正常使用:
rsync -avH --port=873 --progress /www/ rsync@192.168.30.178::backup --password-file=/etc/rsyncd.passwd
三、安装Inotify-tools工具,实时出发rsync进行同步
安装依赖的包
yum install make gcc gcc-c++
下载inotify-tools软件包,此处官方打不开,使用的包是inotify-tools-3.14.tar
编译安装:
tar zxvf inotify-tools-3.14.tar
cd inotify-tools-3.14
./configure --prefix=/usr/local//inotify
make && make install
售前咨询
售后咨询
备案咨询
二维码
TOP