守护进程服务在企业应用

守护进程服务在企业应用

罗小黑
2021-01-08 / 0 评论 / 150 阅读 / 正在检测是否收录...
广告
温馨提示:
本文最后更新于2021年05月15日,已超过1243天没有更新,若内容或图片失效,请留言反馈。

1、守护进程多模块功能配置

    sa sa_data.txt
    dev dev_data.txt
    dba dba_data.txt
    vim /etc/rsync.conf
    #添加以下信息
    [backup]
    comment = "backup dir by oldboy"
    path = /backup
    [dba]
    comment = "backup dir by oldboy"
    path = /dba
    [dev]
    comment = "backup dir by oldboy"
    path = /devdata

2、守护进程的排除环境

    [root@nfs01 /]# mkdir -p /oldboy
    [root@nfs01 /]# mkdir -p /oldboy/{a..c}
    [root@nfs01 /]# touch /oldboy/{a..c}/{1..3}.txt
    [root@nfs01 /]# tree /oldboy
    /oldboy
    ├── 01.txt
    ├── 02.txt
    ├── a
    │?? ├── 1.txt
    │?? ├── 2.txt
    │?? └── 3.txt
    ├── b
    │?? ├── 1.txt
    │?? ├── 2.txt
    │?? └── 3.txt
    └── c
        ├── 1.txt
        ├── 2.txt
        └── 3.txt

01、 需求01: 将/oldboy目录下面 a目录数据全部备份 b目录不要备份1.txt文件 c整个目录不要做备份

    --exclude=PATTERN
    绝对路径方式:
    [root@nfs01 /]# rsync -avz /oldboy --exclude=/oldboy/b/1.txt --exclude=/oldboy/c/rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password 
    sending incremental file list
    oldboy/
    oldboy/01.txt
    oldboy/02.txt
    oldboy/a/
    oldboy/a/1.txt
    oldboy/a/2.txt
    oldboy/a/3.txt
    oldboy/b/
    oldboy/b/2.txt
    oldboy/b/3.txt
    相对路径方式:
    [root@nfs01 /]# rsync -avz /oldboy --exclude=b/1.txt --exclude=c/ rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password 
    sending incremental file list
    oldboy/
    oldboy/01.txt
    oldboy/02.txt
    oldboy/a/
    oldboy/a/1.txt
    oldboy/a/2.txt
    oldboy/a/3.txt
    oldboy/b/
    oldboy/b/2.txt
    oldboy/b/3.txt


​    
​    sent 502 bytes  received 177 bytes  1,358.00 bytes/sec
​    total size is 0  speedup is 0.00

02、将/oldboy目录下面 a目录数据全部备份 b目录不要备份1.txt文件 c整个目录1.txt 3.txt文件不要备份

    --exclude-from=file  --- 批量排除 
    第一个历程: 编辑好一个排除文件
    [root@nfs01 /]# cat /oldboy/exclude.txt 
    b/1.txt
    c/1.txt
    c/3.txt
    exclude.txt
第二个历程: 实现批量排除功能
    [root@nfs01 /]# rsync -avz /oldboy --exclude-from=/oldboy/exclude.txt rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password 
    sending incremental file list
    oldboy/
    oldboy/01.txt
    oldboy/02.txt
    oldboy/a/
    oldboy/a/1.txt
    oldboy/a/2.txt
    oldboy/a/3.txt
    oldboy/b/
    oldboy/b/2.txt
    oldboy/b/3.txt
    oldboy/c/
    oldboy/c/2.txt

03、守护进程来创建备份目录

    [root@nfs01 /]# rsync -avz /etc/hosts  rsync_backup@172.16.1.41::backup/10.0.0.31/ --password-file=/etc/rsync.password 
    sending incremental file list
    created directory 10.0.0.31
    hosts
    sent 226 bytes  received 75 bytes  602.00 bytes/sec
    total size is 371  speedup is 1.23
PS: 客户端无法在服务端创建多级目录

3、 守护进程的访问控制配置

守护进程白名单和黑名单功能
PS: 建议只使用一种名单

守护进程的列表功能配置

    [root@nfs01 /]# rsync rsync_backup@172.16.1.41::
    backup             "backup dir by oldboy"
    dba                "backup dir by oldboy"
    dev                "backup dir by oldboy"
0

打赏


评论 (0)

取消