08.存儲Cinder→5.場景學習→08.Backup Volume→2.實操

背景:html





描述 詳細
  1. 向 cinder-api 發送 backup 請求
    1. 客戶(能夠是 OpenStack 最終用戶,也能夠是其餘程序)向 cinder-api 發送請求:「請 backup 指定的 volume。」 這裏咱們將 backup volume 「vol-1」。
    2. 這裏咱們將 backup volume 「vol-1」。進入 GUI 操做菜單 Project -> Volumes -> Volumes。
    3. 選擇「vol-1」,點擊 「Create Backup」。爲 Backup和Container命名。

  1. cinder-api 將接收到 backup volume 的請求
    1. 查看日誌文件c-api
1
2
3
4
Jun 22 18:46:22 controller devstack@c-api.service[8283]: 
INFO cinder.api.openstack.wsgi
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin admin]
POST http://172.16.1.17/volume/v3/2256dfc087b3452dad55ba5de03ecc10/backups
1
2
3
4
5
6
7
Jun 22 18:46:22 controller devstack@c-api.service[8283]: 
DEBUG cinder.api.openstack.wsgi
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin admin]
Action: 'create', calling method: <bound method BackupsController.create of <cinder.api.v3.backups...
body: {"backup": {"force": true, "description": "", "snapshot_id": null, "incremental": false,
"volume_id": "be755f52-76ba-44bf-bf87-14ccd580336b", "container": "conta-1", "name": "back-1"
{{(pid=8285) process_stack /opt/stack/cinder/cinder/api/openstack/wsgi.py:868
這裏由於 vol-1 已經 attach 到 instance,須要使用 --force 選項(使用命令行時: )
1
2
3
4
5
6
7
Jun 22 18:46:22 controller devstack@c-api.service[8283]: 
DEBUG cinder.api.contrib.backups
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin admin]
Creating new backup {u'backup': {u'container': u'conta-1', u'description': u'', u'snapshot_id': None,
u'incremental': False, u'volume_id': u'be755f52-76ba-44bf-bf87-14ccd580336b', u'force': True,
u'name': u'back-1'
{{(pid=8285) create /opt/stack/cinder/cinder/api/contrib/backups.py:150
1
2
3
4
Jun 22 18:46:22 controller devstack@c-api.service[8283]: 
INFO cinder.api.contrib.backups
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin admin]
Creating backup of volume be755f52-76ba-44bf-bf87-14ccd580336b in container conta-1
  1. cinder-api 發送消息
    1. cinder-api 發送 backup 消息。cinder-api 沒有打印發送消息的日誌,只能經過源代碼查看 /opt/stack/cinder/cinder/backup/api.py,方法爲 create。
  1. cinder-backup 執行 backup 操做:查看c-vol日誌
    1. 啓動 backup 操做,mount NFS。
      1. 我沒找到
      2. 在配置cinder-backup時,已經將 172:16.1.55/backup 目錄計算節點掛載到 
        1
        2
        /opt/stack/data/cinder/backup_mount
        /815381051c57f439493e8c2d80e70715/
        控制節點(存儲節點)  參考見08.存儲Cinder→5.場景學習→8.Backup Volume→1.概述與配置
cloudman:

個人:
1
2
3
4
5
Jun 22 18:46:23 controller cinder-volume[9747]: 
DEBUG cinder.volume.driver
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin None]
Creating a new backup for volume volume-be755f52-76ba-44bf-bf87-14ccd580336b.
{{(pid=9891) get_backup_volume_temp_volume /opt/stack/cinder/cinder/volume/driver.py:1162
  1. 建立 volume 的臨時快照。
1
2
3
4
5
6
7
Jun 22 18:46:24 controller cinder-volume[9747]:
DEBUG oslo_concurrency.processutils
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin None]
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvcreate
--name volume-bdac267c-9149-4309-a80f-15fb3ad05dc0 --snapshot
stack-volumes-lvmdriver-1/volume-be755f52-76ba-44bf-bf87-14ccd580336b

{{(pid=9891) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
  1. 建立存放 backup 的 container 目錄
    1. 我沒找到
    2. 容器conta-1能夠根據backup_mount_point_base的設置找到  參考見08.存儲Cinder→5.場景學習→8.Backup Volume→1.概述與配置
cloudman:

我:
  1. 對臨時快照數據進行壓縮,並保存到 container 目錄。
    1. 我沒找到
cloudman:

chunk (N-COUNT) 厚塊;大塊 [tʃʌŋk]
chunkeddriver.py
Generic base class to implement metadata, compression and chunked data operations
  1. 建立並保存 sha256(加密)文件和 metadata 文件。
    1. 我沒找到
cloudman:
  1. 刪除臨時快照
1
2
3
4
5
6
Jun 22 18:47:01 controller cinder-volume[9747]: 
DEBUG oslo_concurrency.processutils
[None req-6ccc7d02-2350-4a73-82d8-1aed7fdf570f admin None]
CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf lvremove --config activation { retry_deactivation = 1}
-f stack-volumes-lvmdriver-1/volume-bdac267c-9149-4309-a80f-15fb3ad05dc0" returned: 0 in 0.788s
{{(pid=9891) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:409
  1. Backup 完成後,咱們能夠查看一下 container 目錄的內容
    1. volum..._backup...-00001,壓縮後的 backup 文件
    2. volum_..._backup_..._metadata,metadata 文件。
    3. volum_..._backup_..._sha256file,加密文件。




另外,能夠查看計算節點的共享目錄:(在該目錄的任何操做都會在
1
2
/opt/stack/data/cinder/backup_mount
/815381051c57f439493e8c2d80e70715/
同步觀察到,實際上備份是存在該目錄,nfs客戶端將該共享目錄掛載到了本地)
  1. 能夠經過 cinder backup-list 查看當前存在的 backup
  1. 另外cinder backup-create的--incremental選項,表示能夠執行增量備份。若是以前作過普通(全量)備份,以後能夠經過增量備份大大減小須要備份的數據量,是個很不錯的功能。
相關文章
相關標籤/搜索