Home > Database > Mysql Tutorial > body text

rsync配置详解

WBOY
Release: 2016-06-07 15:05:27
Original
1102 people have browsed it

配置 文件/etc/rsyncd.conf 由模块和参数组成.模块由包括在方括号中的模块名开始,直到下一模块的开始为结束.模块的参数格式为 " name = value " 在参数中,只有第一个等号是最主要的. 以#开头的行,被忽略掉. daemon必需有root权限,绑定端口在1024以下(默认是8

配置文件/etc/rsyncd.conf 由模块和参数组成.模块由包括在方括号中的模块名开始,直到下一模块的开始为结束.模块的参数格式为 " name = value "
  在参数中,只有第一个等号是最主要的.
  以#开头的行,被忽略掉.
  daemon必需有root权限,绑定端口在1024以下(默认是873),或者配置文件权限.可以通过inetd,或stand-alone daemon,或才通过远程的rsync客户端对其执行 访问.
  如果使其以stand-alone方式运行,运用命令:rsync --daemon
  以inetd方式运行: 在/etc/services文件中添加以下一行:
      rsync    873/tcp
  在/etc/inetd.conf文件中添加以下一行:
      rsync     stream    tcp    nowait    root    /usr/bin/rsync rsyncd --daemon
  --------------全局参数-----------------------------
  motd file
  定义当客户端访问时看到的信息.默认没有.
  pid file
  定义rsync daemon将其PID写入的文件,如果此文件存在,rsync daemon会终止,而不是覆盖
  port    
  定义daemon监听的端口,(默认是873),如果daemon在被inetd启动时加上 --port参数时,会
  忽略此参数.
  address
  覆盖daemon默认监听的IP地址.如果daemon是被inetd启动,并且有 --address参数时,会被
  忽略
  socket options
  用来防止 被人不停的连接.可以配置为所有socket的端口的传输速度:faster or slower.
  会被在命令行的--sockopts覆盖
  --------------模块参数----------------------------
  模块名无法包括斜钱和关上的方括号.
  comment
  当客户端取得可用模块列表时,在模块名后执行 显示的注示.默认没有.
  path   
  在这个模块中,daemon可以运用的文件系统.必须配置.
  use chroot
  如果被设为"true",daemon会在给客户端传输文件前"chroot to the path".
  numberic ids
  对当前daemon模块,关上能过名字对users 和groups执行 识别.会阻止daemon试图load任何usr/group-related file or libraries.如同客户端运用了 --numeric-ids参数一样.默
  认在chroot中启用,在non-chroot中关上 .
  munge symlinks
  使传进来的文件的链接失效,但是可以还原 .只有在use chroot中并且inside-chroot path
  is "/"时,才会启动,其它时全部失效.
  charset
  配置模块的文件名的存储编码. 如果客户端运用 --icov参数,会被失效.
  max connections
  配置最大连接数.默认为0,意为无限定 .负值为关上这个模块.
  log file
  不设会运用 syslog
  syslog facility
  指定syslog 的名字来启示录rsync daemon.
  max verbosity
  控制信息的最大数量.默认为1,允许客户端请求 one level of verbosity
  lock file
  指定文件用来支撑 "max connections"参数. 默认为/var/run/rsyncd.lock
  read only
  指定客户端能无法 可以上传文件.默认对所有模块都为true
  write only
  不允许下载.
  list
  能无法 允许客户端可以查看可用模块列表.默认为可以.
  uid
  指定用户名或UID取代root.默认为-2,意为nobody
  gid
  同上
  fake super
  设为yes,使文件的权限不以root权限.
  filter
  指定filter chain,指定哪些文件可以让客户端进入.
  exclude
  include
  会覆盖exclude
exclude from<br>include from<br>incoming chmod 指定传入文件的权限<br>outgoing chmod<br>auth users
  指定以空格或,分隔的用户可以运用些模块.用户不一定要在本地系统中存在.默认所有用
  户无密码的访问(anonymous rsync)
  secrets file
  指定用户名和密码.格式   用户名:密码
  strict modes
  指定 secrets file的权限能无法 被检查.true or false
  hosts allow
  指定可以联系的客户端用户名和IP.address/mask,a.b.c.d,hostname,hostname pattern using wildcards
  hosts deny
  默认没有.
  ignore errors
  忽略I/P不正确 .
  ignore nonreadable
  忽略对用户没有可读的文件.
  transfer logging
  log format
  定义logging file transfers,当transfer logging启用时.
<font face="NSimsun">    * %a the remote IP address<br>        * %b the number of bytes actually transferred<br>        * %B the permission bits of the file (e.g. rwxrwxrwt)<br>        * %c the total size of the block checksums received for the basis file (only<br>         when sending)<br>        * %f the filename (long form on sender; no trailing "/")<br>        * %G the gid of the file (decimal) or "DEFAULT"<br>        * %h the remote host name<br>        * %i an itemized list of what is being updated<br>        * %l the length of the file in bytes<br>        * %L the string " -> SYMLINK", " => HARDLINK", or "" (where SYMLINK or <br>         HARDLINK is a filename)<br>        * %m the module name<br>        * %M the last-modified time of the file<br>        * %n the filename (short form; trailing "/" on dir)<br>        * %o the operation, which is "send", "recv", or "del." (the latter includes <br>         the trailing period)<br>        * %p the process ID of this rsync session<br>        * %P the module path<br>        * %t the current date time<br>        * %u the authenticated username or an empty string<br>        * %U the uid of the file (decimal)     <br>timeout</font>

默认为0,意no timeout,建议为600(10分钟)
  refuse options
  daemon拒绝的rsync command line参数
  dont compress
  指定文件不被压缩.压缩耗CPU
  pre-xfer exec,post-xfer exec
  在传输开始或结束运行的命令.下面是配置的环境变量:
<font face="NSimsun">            *   RSYNC_MODULE_NAME: The name of the module being accessed.<br>        * RSYNC_MODULE_PATH: The path configured for the module.<br>        * RSYNC_HOST_ADDR: The accessing host's IP address.<br>        * RSYNC_HOST_NAME: The accessing host's name.<br>        * RSYNC_USER_NAME: The accessing user's name (empty if no user).<br>        * RSYNC_PID: A unique number for this transfer.<br>        * RSYNC_REQUEST: (pre-xfer only) The module/path info specified by the user <br>    (note that the user can specify multiple source files, so the request can be<br>    something like "mod/path1 mod/path2", etc.).<br>        * RSYNC_ARG#: (pre-xfer only) The pre-request arguments are set in these <br>    numbered values. RSYNC_ARG0 is always "rsyncd", and the last value contains <br>    a single period.<br>        * RSYNC_EXIT_STATUS: (post-xfer only) the server side's exit value. This will <br>     be 0 for a successful run, a positive value for an error that the server <br>     generated, or a -1 if rsync failed to exit properly. Note that an error that<br>       occurs on the client side does not currently get sent to the server side, so<br>        this is not the final exit status for the whole transfer.<br>        * RSYNC_RAW_STATUS: (post-xfer only) the raw exit value from waitpid() . </font>
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template