欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

搭建 CentOS 6 服务器(11) - rsync、Amanda

程序员文章站 2022-06-12 15:32:18
...
(一)rsync

Server端
# yum install rsync
# vi /etc/xinetd.d/rsync
    service rsync
    {
        disable = no
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
    }
# vi /etc/rsyncd.conf
    #--------------
    # Global options
    #--------------
    uid           = root
    gid           = root
    log file      = /var/log/rsyncd.log
    pid file      = /var/run/rsyncd.pid
    hosts allow   = 192.168.21.0/24
    hosts deny    = *
    dont compress = *.gz *.tgz *.zip *.pdf *.sit *.sitx *.lzh *.bz2 *.jpg *.gif *.png

    #--------------
    # Module options
    #--------------
    [tmp]
        comment      = rsync server
        path         = /tmp/rsync_folder
        use chroot    = true
        auth users   = rsync_user1, rsync_user2
        secrets file = /etc/rsyncd.secrets
        read only    = false
        exclude      = *.mp
        include      = *.mp30
# mkdir -p /tmp/rsync_folder
# vi /tmp/rsync_folder/a.txt
    test
# vi /etc/rsyncd.secrets
    rsync_user1:password
    rsync_user2:password
# chmod 600 /etc/rsyncd.secrets
# service xinetd restart


Client端
# yum install rsync 
# vi /etc/rsync.passwd 
    password
# chmod 600 /etc/rsync.passwd


确认
# /usr/bin/rsync -avz --delete --password-file=/etc/rsync.passwd rsync://rsync_user1@192.168.21.140/tmp /usr/local/rsynctest
    receiving incremental file list
    ./
    a.txt

    sent 82 bytes  received 156 bytes  476.00 bytes/sec
    total size is 5  speedup is 0.02
# ls -l /usr/local/rsynctest


定期同步
# crontab -e
    #每5分钟同步
    */5 * * * * /usr/bin/rsync -avz --delete --password-file=/etc/rsync.passwd rsync://rsync_user1@192.168.21.140/tmp /usr/local/rsynctest


(二)Amanda

安装
# yum list | grep "^amanda"
  2.6.1p2-9.el6_6 版本比较旧
# yum install amanda


安装3.3.7
# cd /usr/local/src
# wget http://www.zmanda.com/downloads/community/Amanda/3.3.7/Source/amanda-3.3.7-1.rhel6.src.rpm
# rpm -Uvh amanda-3.3.7-1.rhel6.src.rpm


Server端
# vi /etc/hosts
    # amanda server端设置
    192.168.21.91 amcnt
# vi /var/lib/amanda/.amandahosts
    # amanda server端设置
    amcnt root amindexd amidxtaped #restore用
    amcnt amandabackup amdump #backup用
# mkdir -R /etc/amanda/demo
# cd /etc/amanda/demo
# cp /var/lib/amanda/example/amanda.conf .
# vi disklist
    amsrv /usr/data comp-user-tar
# vi /etc/xinetd.d/amanda
   disable = no
# /etc/init.d/xinetd restart


Client端
# vi /etc/hosts
    # amanda client端设置
    192.168.21.90 amsrv
# vi /var/lib/amanda/.amandahosts
   # amanda client端设置
   amsrv amandabackup amdump
# mkdir -R /etc/amanda/demo
# cd /etc/amanda/demo
# vi amanda-client.conf
    conf "demo"          # server端设置的名称
    index_server "amsrv"
    tape_server "amsrv"
    tapedev "file:/var/lib/amanda/vtl"
    auth "bsdtcp"
    ssh_keys ""  
    unreserved-tcp-port 1025,65535
# vi /etc/xinetd.d/amanda
    disable = no
# /etc/init.d/xinetd restart


定期同步
# crontab -e
    45 0 * * 2-6 /usr/sbin/amdump demo