Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

将 Overcloud 与现有 Red Hat Ceph 集群集成

Red Hat OpenStack Platform 13

配置 Overcloud 以使用 Stand-Alone Red Hat Ceph Storage

OpenStack Documentation Team

摘要

本指南介绍了如何使用 Red Hat OpenStack Platform director 将 Overcloud 与现有的独立 Red Hat Ceph 集群集成。

使开源包含更多

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。有关更多详情,请参阅我们的首席技术官 Chris Wright 提供的消息

第 1 章 简介

Red Hat OpenStack Platform (RHOSP) director 创建名为 overcloud 的云环境。director 提供了为 overcloud 配置额外功能的功能。其中一项额外功能包括与红帽 Ceph 存储集成。这包括使用 director 或现有 Ceph Storage 集群创建的 Ceph Storage 集群。

1.1. 定义 Ceph Storage

红帽 Ceph 存储是一种分布式数据对象存储,旨在提供卓越的性能、可靠性和可扩展性。分布式对象存储是未来的存储,因为它们适用于非结构化数据,并且因为客户端可以同时使用现代对象接口和旧接口。每个 Ceph 部署的核心都是 Ceph 存储集群,由两种类型的守护进程组成:

Ceph Object Storage Daemon
Ceph Object Storage Daemon (OSD)代表 Ceph 客户端存储数据。另外,Ceph OSD 使用 Ceph 节点的 CPU 和内存执行数据复制、重新平衡、恢复、监控和报告功能。
Ceph monitor
Ceph monitor (MON)维护 Ceph Storage cluster map 的主副本,该副本具有存储集群的当前状态。

有关 Red Hat Ceph Storage 的更多信息,请参阅 Red Hat Ceph Storage 架构指南

重要

本指南说明了如何使用块存储配置 Ceph。

关于 Ceph 对象网关(RGW):此功能在此发行版本中 作为技术预览提供,因此不受红帽全面支持。它只应用于测试,不应部署在生产环境中。有关技术预览功能的更多信息,请参阅覆盖范围详细信息

不支持 Ceph 文件系统(CephFS)。

1.2. 定义 Scenario

本指南提供有关将现有的 Ceph Storage 集群与 overcloud 集成的说明。这意味着 director 将 overcloud 配置为使用 Ceph Storage 集群来满足存储需求。您可以在 Overcloud 配置之外管理并扩展集群本身。

第 2 章 准备 Overcloud 节点

本章中描述的场景由 Overcloud 中的六个节点组成:

  • 三个具有高可用性的 Controller 节点。
  • 三个 Compute 节点。

director 将一个独立的 Ceph Storage 集群与自己的节点集成到 Overcloud 中。您独立于 Overcloud 管理此集群。例如,您可以使用 Ceph 管理工具来扩展 Ceph Storage 集群,而不通过 OpenStack Platform director 进行扩展。如需更多信息,请参阅 Red Hat Ceph 文档。

2.1. Ceph Storage 的部署前验证

为了帮助避免 overcloud 部署失败,请验证您的服务器上是否存在所需的软件包。

2.1.1. 验证 ceph-ansible 软件包版本

undercloud 包含基于 Ansible 的验证,您可以在部署 overcloud 前运行来识别潜在问题。这些验证可以帮助您避免 overcloud 部署失败,方法是在发生常见问题前识别它们。

流程

验证是否安装了 ceph-ansible 软件包的更正版本:

$ ansible-playbook -i /usr/bin/tripleo-ansible-inventory /usr/share/openstack-tripleo-validations/validations/ceph-ansible-installed.yaml

2.1.2. 为预置备节点验证软件包

当您在 overcloud 部署中使用预置备节点时,您可以验证服务器是否有软件包是托管 Ceph 服务的 overcloud 节点。

有关预置备节点的更多信息,请参阅 使用预置备节点配置基本 overcloud

流程

验证服务器是否包含所需的软件包:

ansible-playbook -i /usr/bin/tripleo-ansible-inventory /usr/share/openstack-tripleo-validations/validations/ceph-dependencies-installed.yaml

2.2. 配置现有的 Ceph Storage 集群

  1. 在与您的环境相关的 Ceph 集群中创建以下池:

    • :OpenStack Block Storage (cinder)的存储
    • 镜像 :OpenStack Image Storage (glance)的存储
    • 虚拟机 :实例的存储
    • 备份 :用于 OpenStack Block Storage Backup (cinder-backup)的存储
    • Metrics: OpenStack Telemetry Metrics (gnocchi)存储

      使用以下命令作为指南:

      [root@ceph ~]# ceph osd pool create volumes PGNUM
      [root@ceph ~]# ceph osd pool create images PGNUM
      [root@ceph ~]# ceph osd pool create vms PGNUM
      [root@ceph ~]# ceph osd pool create backups PGNUM
      [root@ceph ~]# ceph osd pool create metrics PGNUM

      PGNUM 替换为 PG 的数量。我们建议每个 OSD 大约 100 个。例如,OSD 的总数乘以副本数乘以副本数(osd 池默认大小)。您还可以使用 Ceph 放置组(PG)每个池计算器 来确定合适的值。

  2. 在 Ceph 集群中使用以下功能创建 client.openstack 用户:

    • cap_mgr: "allow *"
    • cap_mon: profile rbd
    • cap_osd: profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images, profile rbd pool=backups, profile rbd pool=metrics

      使用以下命令作为指南:

      [root@ceph ~]# ceph auth add client.openstack mgr 'allow *' mon 'profile rbd' osd 'profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images, profile rbd pool=backups, profile rbd pool=metrics'
  3. 注意为 client.openstack 用户创建的 Ceph 客户端密钥:

    [root@ceph ~]# ceph auth list
    ...
    [client.openstack]
    	key = AQC+vYNXgDAgAhAAc8UoYt+OTz5uhV7ItLdwUw==
    	caps mgr = "allow *"
    	caps mon = "profile rbd"
    	caps osd = "profile rbd pool=volumes, profile rbd pool=vms, profile rbd pool=images, profile rbd pool=backups, profile rbd pool=metrics"
    ...

    示例中的 键值 AQC+vYNXgDAgAhAAc8UoYt+OTz5uhV7ItLdwUw== 是您 Ceph 客户端密钥。

  4. 记下 Ceph Storage 集群 的文件系统 ID。这个值通过集群的配置文件中的 fsid 设置来指定(在 [global] 部分):

    [global]
    fsid = 4b5c8c0a-ff60-454b-a1b4-9747aa737d19
    ...
    注意

    有关 Ceph Storage 集群配置文件的更多信息,请参阅 配置参考 (来自 Red Hat Ceph Storage 配置指南)。

Ceph 客户端密钥和文件系统 ID 稍后将在 第 3 章 与现有 Ceph 集群集成 中使用。

2.3. 初始化堆栈用户

stack 用户身份登录 director 主机,再运行以下命令来初始化您的 director 配置:

$ source ~/stackrc

这将设置包含身份验证详情的环境变量,以访问 director 的 CLI 工具。

2.4. 注册节点

节点定义模板(instackenv.json)是一个 JSON 格式文件,包含用于注册节点的硬件和电源管理详情。例如:

{
    "nodes":[
        {
            "mac":[
                "bb:bb:bb:bb:bb:bb"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.205"
        },
        {
            "mac":[
                "cc:cc:cc:cc:cc:cc"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.206"
        },
        {
            "mac":[
                "dd:dd:dd:dd:dd:dd"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.207"
        },
        {
            "mac":[
                "ee:ee:ee:ee:ee:ee"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.208"
        }
        {
            "mac":[
                "ff:ff:ff:ff:ff:ff"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.209"
        }
        {
            "mac":[
                "gg:gg:gg:gg:gg:gg"
            ],
            "cpu":"4",
            "memory":"6144",
            "disk":"40",
            "arch":"x86_64",
            "pm_type":"pxe_ipmitool",
            "pm_user":"admin",
            "pm_password":"p@55w0rd!",
            "pm_addr":"192.0.2.210"
        }
    ]
}

创建模板后,将文件保存到 stack 用户的主目录(/home/stack/instackenv.json)。初始化 stack 用户,然后将 instackenv.json 导入到 director:

$ source ~/stackrc
$ openstack overcloud node import ~/instackenv.json

这会导入模板,并将每个节点从模板注册到 director。

将内核和 ramdisk 镜像分配给每个节点:

$ openstack overcloud node configure <node>

现在,节点已在 director 中注册并进行配置。

2.5. 手动标记节点

注册每个节点后,您需要检查硬件并将节点标记为特定的配置集。profile 标签将您的节点与类别匹配,然后类别分配到部署角色。

要检查和标记新节点,请按照以下步骤执行:

  1. 触发硬件内省以检索每个节点的硬件属性:

    $ openstack overcloud node introspect --all-manageable --provide
    • --all-manageable 选项仅内省处于受管理状态的节点。在这个示例中,它全部是它们。
    • --provide 选项会在内省后将所有节点重置为 主动 状态。

      重要

      确保此进程完成运行。它可能需要 15 分钟来检查这些裸机节点。

  2. 检索节点列表来识别它们的 UUID:

    $ openstack baremetal node list
  3. 在每个节点的 properties/capabilities 参数中添加 profile 选项,以便将节点手动标记到特定的配置集。

    例如,要标记三个节点以使用 control 配置集,另一个三个节点使用 compute 配置集,请运行:

    $ ironic node-update 1a4e30da-b6dc-499d-ba87-0bd8a3819bc0 add properties/capabilities='profile:control,boot_option:local'
    $ ironic node-update 6faba1a9-e2d8-4b7c-95a2-c7fbdc12129a add properties/capabilities='profile:control,boot_option:local'
    $ ironic node-update 5e3b2f50-fcd9-4404-b0a2-59d79924b38e add properties/capabilities='profile:control,boot_option:local'
    $ ironic node-update 484587b2-b3b3-40d5-925b-a26a2fa3036f add properties/capabilities='profile:compute,boot_option:local'
    $ ironic node-update d010460b-38f2-4800-9cc4-d69f0d067efe add properties/capabilities='profile:compute,boot_option:local'
    $ ironic node-update d930e613-3e14-44b9-8240-4f3559801ea6 add properties/capabilities='profile:compute,boot_option:local'

添加 profile 选项会把节点标记为相关的配置集。

注意

作为手动标记的替代,使用 Automated Health Check (AHC)工具根据基准测试数据自动标记大量节点。

第 3 章 与现有 Ceph 集群集成

director 提供的 heat 模板集合已包含部署 overcloud 所需的模板和环境文件。

此环境文件会在部署(第 3.2 节 “部署 Overcloud”)过程中调用,将现有的 Ceph 集群集成到部署的 overcloud 中。

  • /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml

流程

  1. director 使用 ceph-ansible 与现有 Ceph 集群集成,但在 undercloud 上不默认安装 ceph-ansible。输入以下命令在 undercloud 上安装 ceph-ansible 软件包:

    sudo yum install -y ceph-ansible
  2. 要配置集成,您必须将 Ceph 集群的详细信息提供给 director。使用自定义环境文件覆盖 /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml 使用的默认设置:
  3. 创建以下自定义环境文件:

    /home/stack/templates/ceph-config.yaml

  4. 在该文件中添加 parameter_defaults: 标头:

    parameter_defaults:
  5. 在此标题下,设置要在 /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml 中覆盖的所有参数。您至少必须设置以下内容:

    • CephClientKey :Ceph 存储集群的 Ceph 客户端密钥。这是您之前在 第 2.2 节 “配置现有的 Ceph Storage 集群” 中检索的密钥值。例如,AQ DLOh1VgEp6FRAAFzT7Zw+Y9V6JExQAsRnRQ==.
    • CephClusterFSID Ceph Storage 集群的文件系统 ID。这是您在 Ceph Storage 集群配置文件中检索的 fsid 的值,它已在 第 2.2 节 “配置现有的 Ceph Storage 集群” 中检索。例如: 4b5c8c0a-ff60-454b-a1b4-9747aa737d19
    • CephExternalMonHost :以逗号分隔的 Ceph Storage 集群中所有 MON 主机的 IP 地址列表。例如 172.16.1.7, 172.16.1.8

      parameter_defaults:
        CephClientKey: AQDLOh1VgEp6FRAAFzT7Zw+Y9V6JJExQAsRnRQ==
        CephClusterFSID: 4b5c8c0a-ff60-454b-a1b4-9747aa737d19
        CephExternalMonHost: 172.16.1.7, 172.16.1.8
  6. 如果需要,还要使用以下参数和值设置 OpenStack 池和客户端用户的名称:

    • CephClientUserName: openstack
    • NovaRbdPoolName: vms
    • CinderRbdPoolName: volumes
    • GlanceRbdPoolName: images
    • CinderBackupRbdPoolName: backup
    • GnocchiRbdPoolName: metrics
  7. 您还可以将 overcloud 参数添加到自定义环境文件。例如,要将 vxlan 设置为 neutron 网络类型,请将以下内容添加到 parameter_defaults 中:

      NeutronNetworkType: vxlan

3.1. 为角色分配节点和类别

规划 overcloud 部署涉及指定多少个节点以及分配给各个角色的类别。与所有 Heat 模板参数一样,这些角色规格在自定义环境文件的 parameter_defaults 部分中声明(本例中为 /home/stack/templates/ceph-config ): 第 3 章 与现有 Ceph 集群集成

要做到这一点,请使用以下参数:

表 3.1. Overcloud 节点的角色和类别

Heat 模板参数Description

ControllerCount

扩展的 Controller 节点数量

OvercloudControlFlavor

Controller 节点使用的 flavor (控制)

ComputeCount

扩展的 Compute 节点数量

OvercloudComputeFlavor

用于 Compute 节点的 flavor (计算)

例如,要将 overcloud 配置为为每个角色(Controller 和 Compute)部署三个节点,请将以下内容添加到您的 parameter_defaults 中:

parameter_defaults:
  ControllerCount: 3
  ComputeCount: 3
  OvercloudControlFlavor: control
  OvercloudComputeFlavor: compute
注意

如需更完整的 Heat 模板参数列表,请参阅 Director 安装和使用 指南中的使用 CLI 工具创建 Overcloud

3.2. 部署 Overcloud

注意

在 undercloud 安装过程中,在 undercloud.conf 文件中设置 generate_service_certificate=false。否则,必须在部署 overcloud 时注入信任定位器。有关如何注入信任定位器的更多信息,请参阅高级 Overcloud 自定义指南中的 在 Overcloud 公共端点上启用 SSL/TLS

创建 overcloud 需要 openstack overcloud deploy 命令的额外参数。例如:

$ openstack overcloud deploy --templates \
  -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml \
  -e /home/stack/templates/ceph-config.yaml \
  -e --ntp-server pool.ntp.org \

以上命令使用以下选项:

  • --templates - 从默认 Heat 模板集合中创建 Overcloud (名称,/usr/share/openstack-tripleo-heat-templates/)。
  • -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml - 设置 director 以将现有的 Ceph 集群整合到 overcloud。
  • -e /home/stack/templates/ceph-config.yaml - 添加自定义环境文件以覆盖 -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml 设定的默认值。在这种情况下,它是您在 第 3 章 与现有 Ceph 集群集成 中创建的自定义环境文件。
  • --ntp-server pool.ntp.org - Sets our NTP server.
提示

您还可以使用 回答文件 来调用所有模板和环境文件。例如,您可以使用以下命令部署相同的 overcloud:

$ openstack overcloud deploy \
  --answers-file /home/stack/templates/answers.yaml \
  --ntp-server pool.ntp.org

在这种情况下,该文件 /home/stack/templates/answers.yaml 包含:

templates: /usr/share/openstack-tripleo-heat-templates/
environments:
  - /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible-external.yaml \
  - /home/stack/templates/ceph-config.yaml \

如需更多信息,请参阅 Overcloud 创建中包含环境文件

如需完整的选项列表,请运行:

$ openstack help overcloud deploy

有关更多信息,请参阅 Director 安装和使用 指南中的使用 CLI 工具创建 Overcloud

overcloud 创建过程开始,director 置备您的节点。完成此过程需要一些时间。要查看 overcloud 创建的状态,请以 stack 用户身份打开一个单独的终端并运行:

$ source ~/stackrc
$ openstack stack list --nested

这会将 Overcloud 配置为使用外部 Ceph Storage 集群。请注意,您独立于 Overcloud 管理此集群。例如,您可以使用 Ceph 管理工具来扩展 Ceph Storage 集群,而不通过 OpenStack Platform director 进行扩展。

第 4 章 访问 Overcloud

director 会生成脚本来配置和帮助认证 director 主机与 overcloud 的交互。director 将此文件(overcloudrc)保存到 stack 用户的主目录中。运行以下命令来使用此文件:

$ source ~/overcloudrc

这会加载必要的环境变量,以便从 director 主机的 CLI 与 overcloud 交互。要返回与 director 主机进行交互的状态,请运行以下命令:

$ source ~/stackrc

法律通告

Copyright © 2023 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.