Chinaunix

标题: 请教一个rsync的问题 [打印本页]

作者: angeler    时间: 2010-07-12 16:12
标题: 请教一个rsync的问题
大家好,最近我在工作中遇到一个十分诡异的问题,具体是这样子的。
  1. rsync -azv -e "ssh -p 22 -1 -o StrictHostKeyChecking=no" w4.ynews:"/home/logs/nd/access-2010-07-11-06*.gz /home/logs/nd/access-2010-07-11-18*.gz /home/logs/nd/access-2010-07-12-00*.gz" /filer/udc/daily/20100711/w4.ynews/fe/
  2. receiving file list ... done
  3. ./
  4. .ssh/
  5. .ssh/authorized_keys

  6. sent 36 bytes  received 699 bytes  1470.00 bytes/sec
  7. total size is 1003  speedup is 1.36
复制代码


在w4.ynews这台服务器上并没有/home/logs/nd目录,不知道为什么这个命令不报错误,反而将w4.ynews的个人目录下的.ssh拷贝过来了,请问大家有遇到过这种问题么,盼回复~~
作者: angeler    时间: 2010-07-12 16:28
我又做了一个测试
  1. rsync -azv -e "ssh -p 22 -1 -o StrictHostKeyChecking=no" yahoo@w4.ynews:/home/logs/nd  /filer/udc/daily/20100711/w4.ynews/

  2. receiving file list ... rsync: link_stat "/home/y/logs/yapache/nd" failed: No such file or directory (2)
  3. done
  4. client: nothing to do: perhaps you need to specify some filenames or the --recursive option?
  5. rsync error: some files could not be transferred (code 23) at main.c(723)
复制代码
nd目录不存在,我如果直接rsync nd目录的话,就会提示"No such file or directory".
作者: lonelysoul011    时间: 2010-07-12 17:21
手动创建这个目录试试~!
作者: wild_li    时间: 2010-07-12 22:17
没明白想表明啥意思.
作者: angeler    时间: 2010-07-13 09:55
回复 3# lonelysoul011

手动创建这个目录是没有这个问题的,rsync会报错提示目录或者文件不存在,现在的问题就是如果这个目录不存在,我rsync的时候,他竟然把.ssh目录rsync过来,命令也不会报错。
作者: angeler    时间: 2010-07-13 09:56
没明白想表明啥意思.
wild_li 发表于 2010-07-12 22:17


我的意思就是说rsync的时候,如果目录不存在应该报错才对,可是不明白这个rsync为啥目录没有,他不报错,竟然将home目录下的.ssh目录拷贝过来了呢?
作者: angeler    时间: 2010-07-13 10:01
大家好,最近我在工作中遇到一个十分诡异的问题,具体是这样子的。


在w4.ynews这台服务器上并没有/hom ...
angeler 发表于 2010-07-12 16:12


进一步定位发现,应该是和通配符'*'有关系,如果我将*去掉,命令就比较正常了。难道是rsync的bug?
作者: angeler    时间: 2010-07-13 10:28
问题进一步定位,本地系统为linux 32位,w4.ynews为linux 64位。我又测试了一下linux 32位到linux32位的和Linux 32位 和BSD的,都没有问题。难道是linux 32位和64位之间某些东东不兼容?
作者: blackold    时间: 2010-07-13 10:54
参考远程shell对word-splitting的解释。
作者: angeler    时间: 2010-07-13 11:45
参考远程shell对word-splitting的解释。
blackold 发表于 2010-07-13 10:54


感谢您的回复,您能说的更详细一些么,具体这个命令是在哪个地方word-splitting出现问题,我也好比较方便的入手。
作者: blackold    时间: 2010-07-13 12:46
回复 10# angeler


    还没碰到过这种问题。

你可以试试:
  1. rsync -azv w4.ynews:"/home/logs/nd/access-2010-07-11-06*.gz /home/logs/nd/access-2010-07-11-18*.gz /home/logs/nd/access-2010-07-12-00*.gz" /filer/udc/daily/20100711/w4.ynews/fe/
复制代码
或者

逐个测试,看看问题出在哪里
  1. rsync -azv -e "ssh -p 22 -1 -o StrictHostKeyChecking=no" w4.ynews:"/home/logs/nd/access-2010-07-11-06*.gz" /filer/udc/daily/20100711/w4.ynews/fe/
复制代码

作者: angeler    时间: 2010-07-13 13:58
回复  angeler


    还没碰到过这种问题。

你可以试试:或者

逐个测试,看看问题出在哪里
blackold 发表于 2010-07-13 12:46


本地服务器是Linux 32位,w4.ynews是Linux 64位,w5.ynews也是Linux 64位,w1.ynews是BSD的。

以下是Linux 32位与Linux 64位之前rsync命令
  1. rsync -azv -e "ssh -p 22 -1 -o StrictHostKeyChecking=no" w5.ynews:"/home/logs/nd/access-2010-07-11-06*.gz /home/logs/nd/access-2010-07-11-18*.gz /home/logs/nd/access-2010-07-12-00*.gz" /filer/udc/daily/20100711/w5.ynews/fe/
  2. receiving file list ... done
  3. ./
  4. .ssh/
  5. .ssh/authorized_keys

  6. sent 36 bytes  received 699 bytes  1470.00 bytes/sec
  7. total size is 1003  speedup is 1.36
复制代码
以下是Linux 32位与BSD之间rsync命令
  1. rsync -azv -e "ssh -p 22 -1 -o StrictHostKeyChecking=no" w1.ynews:"/home/logs/nd/access-2010-07-11-06*.gz /home/logs/nd/access-2010-07-11-18*.gz /home/logs/nd/access-2010-07-12-00*.gz" /filer/udc/daily/20100711/w1.ynews/fe/
  2. receiving file list ... rsync: link_stat "/home/logs/nd/access-2010-07-11-06*.gz" failed: No such file or directory (2)
  3. rsync: link_stat "/home/logs/nd/access-2010-07-11-18*.gz" failed: No such file or directory (2)
  4. rsync: link_stat "/home/logs/nd/access-2010-07-12-00*.gz" failed: No such file or directory (2)
  5. done
  6. client: nothing to do: perhaps you need to specify some filenames or the --recursive option?
  7. rsync error: some files could not be transferred (code 23) at main.c(723)
复制代码

作者: blackold    时间: 2010-07-13 15:03
回复 12# angeler


    不带-e的命令测试过吗?
作者: angeler    时间: 2010-07-13 15:21
回复  angeler


    不带-e的命令测试过吗?
blackold 发表于 2010-07-13 15:03
  1. rsync -azv  w4.ynews:"/home/logs/nd/access-2010-07-11-06*.gz /home/logs/nd/access-2010-07-11-18*.gz /home/logs/nd/access-2010-07-12-00*.gz" /filer/udc/daily/20100711/w5.ynews/fe/
  2. receiving file list ... done
  3. ./
  4. .ssh/
  5. .ssh/authorized_keys

  6. sent 36 bytes  received 699 bytes  1470.00 bytes/sec
  7. total size is 1003  speedup is 1.36
复制代码
我ssh version默认是2,如果不带-e只能将ssh version默认改为1了,呵呵,不过不带-e仍然是这样子的。
作者: blackold    时间: 2010-07-13 15:33
回复 14# angeler


    看起来与ssh的配置有关,没有测试环境,无法测试。
作者: angeler    时间: 2010-07-15 13:19
回复 15# blackold

恩,我再自己测试一下吧,非常感谢您的回复




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2