08.存储Cinder→5.场景学习→08.Backup Volume→1.概述与配置

  1. Backup 是将 volume 备份到别的地方(备份设备),将来可以通过 restore 操作恢复。
  2.  backup 功能好像与 snapshot 很相似,都可以保存 volume 的当前状态,以备以后恢复。但二者在用途和实现上还是有区别的,具体表现在:
    1. Snapshot 依赖于源 volume,不能独立存在;而 backup 不依赖源 volume,即便源 volume 不存在了,也可以 restore。
      1. Snapshot 与源 volume 通常存放在一起,都由同一个 volume provider 管理;而 backup 存放在独立的备份设备中,有自己的备份方案和实现,与 volume provider 没有关系。
    2. 因此 backup 具有容灾功能;而 snapshot 则提供 volume provider 内便捷的回溯功能。
  3. 配置cinder-backup
    1. Cinder 的 backup 功能是由 cinder-backup 服务提供的,devstack 默认没有启用该服务,需要手工启用。paste-62732292325379.jpg
    2. 与 cinder-volume 类似,cinder-backup 也通过 driver 架构支持多种备份 backend,包括POSIX 文件系统、NFS、Ceph、GlusterFS、Swift 和 IBM TSM
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      root@controller:~# ll /opt/stack/cinder/cinder/backup/drivers/
      total 140
      drwxr-xr-x 2 stack stack  4096 Jun 14 14:47 ./
      drwxr-xr-x 3 stack stack  4096 Jun 14 16:41 ../
      -rw-r--r-- 1 stack stack 54276 Jun 14 14:47 ceph.py
      -rw-r--r-- 1 stack stack  3528 Jun 14 14:47 glusterfs.py
      -rw-r--r-- 1 stack stack 14245 Jun 14 14:47 google.py
      -rw-r--r-- 1 stack stack     0 Jun 14 14:47 __init__.py
      -rw-r--r-- 1 stack stack  3868 Jun 14 14:47 nfs.py
      -rw-r--r-- 1 stack stack  5864 Jun 14 14:47 posix.py
      -rw-r--r-- 1 stack stack 18587 Jun 14 14:47 swift.py
      -rw-r--r-- 1 stack stack 21172 Jun 14 14:47 tsm.py

    3. 这里以 NFS 为 backend 来研究 backup 操作,在/etc/cinder/cinder.conf中进行配置:
      1
      2
      3
      4
      5
      root@controller:~# vim /etc/cinder/cinder.conf
      [DEFAULT]
      backup_driver = cinder.backup.drivers.nfs
      backup_mount_point_base = $state_path/backup_mount
      backup_share = 172.16.1.55:/backup
    4. 其中变量state_path在cinder.conf表示的是paste-252969278767107.jpg
      172.16.1.55是计算节点的管理网ip;172.16.1.55:/backup为存放 volume backup 的 NFS 远程目录;nfs客户端上mount point 为 $state_path/backup_mount(挂载点位置)

    5. NFS配置:
      1. 计算节点(NFS 服务器):
        1. 安装NFS服务器:root@compute:/# apt install nfs-kernel-server
        2. 编写配置文件:
          1
          2
          root@compute:/# vim /etc/exports
          /backup *(rw,sync,no_subtree_check,no_root_squash)
          paste-106257490903043.jpg
          *表示不对客户端做限制,如果指定具体的客户端,将client替换为客户端ip。rw表示客户端可以读写服务器(即二者中有一方更改,另一边也作同样更改)
        3. 创建共享目录:root@compute:/# mkdir -p /backup
        4. 重启nfs服务:
           1
           2
           3
           4
           5
           6
           7
           8
           9
          10
          11
          12
          13
          14
          root@compute:/# systemctl restart nfs-kernel-server.service
          root@compute:/# systemctl status nfs-kernel-server.service
          * nfs-server.service - NFS server and services
             Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
             Active:  (exited) since Fri 2019-06-21 17:26:12 CST; 13s ago
            Process: 4152 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
            Process: 4146 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
            Process: 4142 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
            Process: 4172 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
            Process: 4168 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
           Main PID: 4172 (code=exited, status=0/SUCCESS)
          
          Jun 21 17:26:12 compute systemd[1]: Starting NFS server and services...
          Jun 21 17:26:12 compute systemd[1]: Started NFS server and services.

      2. 控制节点(NFS客户端)
        1. 安装客户端工具:root@controller:/# apt install nfs-common
        2. 查看NFS服务器上的共享目录:  
          1
          2
          3
          root@controller:/# showmount -e 172.16.1.55
          Export list for 172.16.1.55:
          /backup *
          e:export
    6. 手工启动cinder-backup服务: 
      1. root@controller:~# nohup /usr/bin/python /usr/local/bin/cinder-backup --config-file /etc/cinder/cinder.conf &
        1. 执行:paste-268667384233987.jpgmount -t nfs -o ... 172:16.1.55/backup /opt/stack/data/cinder/backup_mount/815381051c57f439493e8c2d80e70715/  backup_mount2不要管这个2,在记笔记的时候多试验了一次
        2. 实际上是将远程共享目录计算节点挂载到本地/opt/stack/data/cinder/backup_mount控制节点
        3. nohup是一个忽略HUP信号的POSIX命令,将命令放在nohup和&中间表示即使关闭xshell,远程主机的命令也会继续执行
          1. 否则在关闭xshell后,服务关闭,cinder-backup服务的State会变为down
          2. 在运行完你要运行的命令后,重开一个xshell进行后续操作吧!
  4. 查看服务:
    1
    2
    3
    4
    5
    6
    7
    8
    root@controller:~# cinder service-list               
    +------------------+------------------------+------+---------+-------+----------------------------+-----------------+
    | Binary           | Host                   | Zone | Status  | State | Updated_at                 | Disabled Reason |
    +------------------+------------------------+------+---------+-------+----------------------------+-----------------+
    | cinder-backup    | controller             | nova | enabled | up    | 2019-06-21T10:10:17.000000 | -               |
    | cinder-scheduler | controller             | nova | enabled | up    | 2019-06-21T10:10:17.000000 | -               |
    | cinder-volume    | controller@lvmdriver-1 | nova | enabled | up    | 2019-06-21T10:10:14.000000 | -               |
    +------------------+------------------------+------+---------+-------+----------------------------+-----------------+
    paste-128986457833475.jpg
  5. dashboard配置backup选项
    1
    2
    3
    4
    5
    6
    7
    8
    #配置dashboard文件
    root@controller:~# vim /opt/stack/horizon/openstack_dashboard/local/local_settings.py
    #更改为True(默认为False)
    OPENSTACK_CINDER_FEATURES = {
        'enable_backup': True,
    }
    #重启web服务和会话存储
    root@controller:~# systemctl reload apache2.service
    paste-152587303124995.jpg配置后:paste-153291677761539.jpgpaste-154026117169155.jpg
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值