Menu Close

10.2.5. 运行 lv-create.yml Ansible Playbook

lv-create.yml playbook 的目的是在单个 NVMe 中为对象网关存储桶索引和日志创建逻辑卷。它使用 osd_scenario=lvm 而不是使用 osd_scenario=non-collocated。通过自动化一些复杂的 LVM 创建和配置,lv-create.yml Ansible playbook 使以这种方式配置 Ceph 变得更加简单。

  1. 作为 root,将 lv-create.yml Ansible playbook 复制到当前目录中:

    # cp infrastructure-playbooks/lv-create.yml .
  2. 确保存储设备是 raw

    在运行 lv-create.yml 在 NVMe 设备和 HDD 设备中创建逻辑卷前,请确保它们中没有文件系统、GPT、RAID 或其他签名。

    如果它们不是原始的,当运行 lv-create.yml 时可能会失败,并显示以下错误:

    device /dev/sdc excluded by a filter
  3. wipe 存储设备签名(可选)

    如果设备有签名,您可以使用 wipefs 擦除它们。

    以下是使用 wipefs 擦除设备的示例:

    [root@c04-h01-6048r ~]# wipefs -a /dev/sdc
    /dev/sdc: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdc: 8 bytes were erased at offset 0x1d19ffffe00 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdc: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
    /dev/sdc: calling ioclt to re-read partition table: Success
    [root@c04-h01-6048r ~]# wipefs -a /dev/sdd
    /dev/sdd: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdd: 8 bytes were erased at offset 0x1d19ffffe00 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdd: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
    /dev/sdd: calling ioclt to re-read partition table: Success
    [root@c04-h01-6048r ~]# wipefs -a /dev/sde
    /dev/sde: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
    /dev/sde: 8 bytes were erased at offset 0x1d19ffffe00 (gpt): 45 46 49 20 50 41 52 54
    /dev/sde: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
    /dev/sde: calling ioclt to re-read partition table: Success
    [root@c04-h01-6048r ~]# wipefs -a /dev/sdf
    /dev/sdf: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdf: 8 bytes were erased at offset 0x1d19ffffe00 (gpt): 45 46 49 20 50 41 52 54
    /dev/sdf: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
    /dev/sdf: calling ioclt to re-read partition table: Success
  4. 运行 lv-teardown.yml Ansible playbook:

    总是在运行 lv-create.yml 前运行 lv-teardown.yml

    作为 root,将 lv-teardown.yml Ansible playbook 复制到当前目录中:

    # cp infrastructure-playbooks/lv-teardown.yml .

    运行 lv-teardown.yml Ansible playbook:

    $ ansible-playbook lv-teardown.yml -i hosts
    警告

    运行 lv-teardown.yml Ansible 脚本时请谨慎操作。它销毁数据。确保您已备份了任何重要数据。

  5. 运行 lv-create.yml Ansible playbook:

    $ ansible-playbook lv-create.yml -i hosts