`
7shao
  • 浏览: 51770 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

rsync配置及报错处理

阅读更多
服务器端配置文件:
首先安装rsync+xinetd
并启用/usr/bin/rsync --daemon
配置文件如下:
more /etc/rsyncd.conf
list = yes
uid = root
gid = root
use chroot = no
#strict modes = false
host_allow = *
max connections =200
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
#secrets file=/etc/rsyncd.secrets


[test]
path = /root/Test
read only = no
transfer logging = yes

下面配置文件:
more /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it \
#       allows crc checksumming etc.
service rsync
{
        disable = no
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}
改更要重启的: service xinetd restart 
客户端可能会存在以下报错。
[root@localhost /]# rsync -vzrtopg --delete --progress rsync\@192.168.1.106::test /cc
rsync: failed to connect to 192.168.1.106: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]


改了之后,客户端就可以正常同步了。
还有一个以下报错。
[root@localhost Test]# rsync -vzrtopg --delete --progress rsync\@192.168.1.106::test /Test
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [receiver=3.0.6]



以下内容来自http://tonykorn97.itpub.net/post/6414/462027
停止掉xinetd后查看端口的占用状态:
[root@tonykorn xinetd.d]# /etc/init.d/xinetd status
xinetd (pid 16964) is running...
[root@tonykorn xinetd.d]# /etc/init.d/xinetd stop
Stopping xinetd: [ OK ]
[root@tonykorn xinetd.d]# netstat -na | grep 873
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN
unix 3 [ ] STREAM CONNECTED 76873
[root@tonykorn xinetd.d]#


查看那个程序在使用这个端口:
[root@tonykorn xinetd.d]# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:4001 0.0.0.0:* LISTEN 7376/backprice
tcp 0 0 0.0.0.0:8033 0.0.0.0:* LISTEN 3443/nsrindexd
tcp 0 0 0.0.0.0:7937 0.0.0.0:* LISTEN 3357/nsrexecd
tcp 0 0 0.0.0.0:4002 0.0.0.0:* LISTEN 7374/backpos
tcp 0 0 0.0.0.0:7938 0.0.0.0:* LISTEN 3354/nsrexecd
tcp 0 0 0.0.0.0:4004 0.0.0.0:* LISTEN 7387/tranmember
tcp 0 0 0.0.0.0:13253 0.0.0.0:* LISTEN 3358/lgtolmd
tcp 0 0 0.0.0.0:9382 0.0.0.0:* LISTEN 3361/nsrd
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2811/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2772/portmap


查找那个程序启动的这个端口,关闭这个服务
[root@tonykorn xinetd.d]# chkconfig --list | grep nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
[root@tonykorn xinetd.d]# service nfslock status
rpc.statd (pid 2811) is running...
[root@tonykorn xinetd.d]# service nfslock stop
Stopping NFS statd: [ OK ]
[root@tonykorn xinetd.d]# netstat -lnp | grep 873
[root@tonykorn xinetd.d]# netstat -na | grep 873
[root@tonykorn xinetd.d]#


重新启动xinetd服务
[root@tonykorn xinetd.d]# /etc/init.d/xinetd start
Starting xinetd: [ OK ]
[root@tonykorn xinetd.d]# vi /var/log/messages

May 15 13:27:50 tonykorn rpc.statd[2811]: Caught signal 15, un-registering and exiting.
May 15 13:28:52 tonykorn xinetd[18304]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
May 15 13:28:52 tonykorn xinetd[18304]: Started working: 3 available services

从日志上可以看到服务器已经启动。


经过这上面的提示,后解决了。

出现如下错误:
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1296) [sender=2.6.8]
原因及解决方法:
test文件没有建,建后,同步成功。

还可能存在的问题
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=2.6.8]
原因及解决办法:
    SELinux;
    setsebool -P rsync_disable_trans on
分享到:
评论

相关推荐

    rsync相对于其他同步工具的优缺点介绍

    在进行大数据量同步时,xcopy在单个文件失败时可能会导致整个同步过程中断,而SecondCopy在处理大量文件时可能会卡住并不断报错。rsync在这些场景下能够保持较高的稳定性。 6. 日志记录:rsync提供了详细的同步日志...

    Spotlight on Unix/Linux

    - 多任务处理:能够同时运行多个应用程序。 - 文件系统:采用层次化的文件系统结构。 - 安全性高:具有严格的权限管理机制。 #### 二、Unix/Linux安装与配置 - **安装方式:** - 通过光盘或USB进行安装。 - ...

    linux下将一个目录中文件复制到另一个目录中

    - 如果目标目录不存在,`cp` 会报错,而 `rsync` 会尝试创建目标目录。 - 使用这些命令时,确保你有足够的权限访问源和目标路径。 4. **使用脚本自动化**: 对于频繁执行的任务,可以编写Shell脚本来自动化这个...

    cwrsync invalid uid nobody 解决方法

    这个错误通常发生在配置rsync服务端时,服务端在接收到客户端请求并尝试建立客户端-服务端协议时,因为uid(用户标识)为nobody而报错。这里的“nobody”通常是指不存在的用户,或者系统中没有为该用户分配正确的UID...

    hive2.1.1中orc格式读取报数组越界错误解决方法

    在实际操作中,可以使用如`rsync`或`scp`等工具将jar包复制到集群中的每一台服务器,并且更新Hive的相关配置,指向新版本的jar路径。 此外,为了预防类似问题,建议定期检查Hive和其依赖的组件是否有新的版本或补丁...

    Hadoop Windows系统安装包 和 winutils的文件

    在Windows上安装和配置Hadoop可能比在Linux上复杂,但通过以上步骤,你应该能够在Windows环境中运行Hadoop,进行大数据处理。在实际应用中,Hadoop常与其他大数据工具如Hive、Pig、Spark等结合使用,构建更强大的...

    Linux系统故障诊断与排除

    2. **错误代码解析**:当系统或应用报错时,通常会提供一个错误代码,比如`errno`,查阅相关文档或在线搜索可了解其含义。 3. **系统监控**:利用`top`、`htop`、`iotop`、`vmstat`、`iostat`、`free`等命令实时...

Global site tag (gtag.js) - Google Analytics