zoukankan      html  css  js  c++  java
  • Rsync安装部署

    Rsync安装部署

    1.Rsync  简介

    Rsync  是一款开源的、快速的 多功能的 可以实现全量以及增量的本地或者是远程的数据同步备份的优秀工具,并且可以不进行改变原有的数据属性信息,实现数据的备份和迁移的特性 ,Rsync 软件适用于 Linux/unix/windows  等多种操作系统上 。

    2.Rsync可以实现的备份方式 ;

    本地备份;
    远程备份;
    无差异备份;
    

      

    3.Rsync实现方式介绍 ;

    全量备份数据
    增量备份数据
    

      

    4.查看软件是否安装

    [root@pre2 ~]# rpm -qa | grep rsync
    rsync-3.0.9-17.el7.x86_64
    puppet-rsync-0.4.0-3.447685fgit.el7.noarch
    

      

    5.查看版本信息

    [root@pre2 ~]# rsync --version
    rsync  version 3.0.9  protocol version 30
    Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
    Web site: http://rsync.samba.org/
    Capabilities:
        64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
        socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
        append, ACLs, xattrs, iconv, symtimes
     
    rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
    are welcome to redistribute it under certain conditions.  See the GNU
    General Public Licence for details.                         
    

      

    6.配置rsync软件的配置文件

    cat >/etc/rsyncd.conf<<EOF
    uid = rsync
    gid = rsync
    use chroot = no
    max connections = 200
    timeout = 300
    pid file = /var/run/rsyncd.pid
    lock file = /var/run/rsync.lock
    log file = /var/log/rsyncd.log
    ignore errors
    read only = false
    list = false
    hosts allow = 192.168.3.0/24
    hosts deny = 0.0.0.0/32
    auth users = rsync_backup
    secrets file = /etc/rsync.password
    
    [backup]
    path = /root/backup
    EOF
    

      

    7.配置文件注释

    #rsync_config
    ##rsyncd.conf start##
    uid = rsync                             # 用户 远端的命令使用rsync访问共享目录
    gid = rsync                           # 用户组                        
    use chroot = no                        # 安全相关
    max connections = 200                # 最大连接数
    timeout = 300                        # 超时时间
    pid file = /var/run/rsyncd.pid      # 进程对应的进程号文件
    lock file = /var/run/rsyncd.lock    # 锁文件
    log file = /var/log/rsyncd.log      # 日志文件
    ignore errors                        # 忽略错误
    read only = false                    # 可写
    list = false                         # 不能列表
    hosts allow = 172.16.1.0/24          # 允许连接的服务器
    hosts deny = 0.0.0.0/32               # 后勤组连接的服务器
    auth users = rsync_backup             # 虚拟用户
    secrets file = /etc/rsync.password   # 虚拟用户对应的用户和密码文件
    
    [backup]                            # 模块名称
    path = /backup                      # 服务端提供访问的目录
    

      

    8.创建备份存储的目录,和创建管理用户用户组

    [root@pre2 ~]# mkdir -p backup                 #创建目录
    
    [root@rsync ~]# ls
    backup  install.log  install.log.syslog  optimize-init_sys.sh  sysctl.conf
    
    [root@pre2 ~]# useradd rsync -s /sbin/nologin -M     #创建rsync备份目录的管理用户与用户组
    
    [root@pre ~]# chown -R rsync.rsync backup/                #授权
    

      

    第二步;创建服务端和客户端的身份认证文件

    [root@pre2 ~]# echo "rsync_backup:rsync123" >/etc/rsync.password
    
    [root@pre2 ~]# chmod 600 /etc/rsync.password   #配置文件权限只允许 root 用户查看 
    
    [root@pre2 ~]# cat /etc/rsync.password
    rsync_backup:rsync123
    

     

    启动 rsync 服务

    [root@pre2 ~]# rsync --daemon
    
    [root@pre2 ~]# netstat -lntup |grep rsync
    tcp6       0      0 :::873                  :::*                    LISTEN      14564/rsync 

    CentOS 默认以 xinetd 方式运行 rsync 服务。rsync 的 xinetd 配置文件 在 /etc/xinetd.d/rsync。

    要配置以 xinetd 运行的 rsync 服务需要执行如下的命令,也可以rsync --daemon 这样独立运行 。

    # chkconfig rsync on
    # service xinetd restart    
    

      

    9.客户端配置 

    [root@pre1 ~]# rpm -qa|grep rsync
    rsync-3.0.9-17.el7.x86_64
    puppet-rsync-0.4.0-3.447685fgit.el7.noarch
    
    [root@pre1 ~]# echo "rsync123" >/etc/rsync.password
    
    [root@pre1 ~]# cat /etc/rsync.password
    rsync123
    
    [root@pre1 ~]# chmod 600 /etc/rsync.password
    
    [root@pre1 ~]# ls -ld /etc/rsync.password
    -rw-r--r-- 1 root root 9 May 13 17:15 /etc/rsync.password
    

      

  • 相关阅读:
    Codeforces Round #534 Div. 1
    Codeforces Round #540 Div. 3 F2
    Educational Codeforces Round 60 Div. 2
    Luogu4389 付公主的背包(生成函数+多项式exp)
    BZOJ1005 HNOI2008明明的烦恼(prufer+高精度)
    Codeforces Round #539 Div. 1
    js --- 关于DOM的事件操作
    js函数
    js常用内置对象
    js数据类型转换 ----流程控制
  • 原文地址:https://www.cnblogs.com/heyongboke/p/10861781.html
Copyright © 2011-2022 走看看