6.4. 为单个镜像服务 API 实例配置多存储


您可以使用多个存储后端配置 Image 服务(glance)。

要为单个镜像服务 API (glanceAPI)实例配置多个后端,您可以使用键值对设置 enabled_backends 参数。键是存储的标识符,值是存储的类型。以下值有效:

  • file
  • http
  • rbd
  • swift
  • cinder

先决条件

流程

  1. 打开 OpenStackControlPlane CR 文件 openstack_control_plane.yaml,并在 glance 模板中添加参数来配置后端。在以下示例中,有两个 Ceph RBD 存储和一个 Object Storage 服务(swift)存储:

    ...
    spec:
      glance:
        template:
          customServiceConfig: |
            [DEFAULT]
            debug=True
            enabled_backends = ceph-0:rbd,ceph-1:rbd,swift-0:swift
    ...
  2. 指定要用作默认后端的后端。在以下示例中,默认后端为 ceph-1

    ...
          customServiceConfig: |
            [DEFAULT]
            debug=True
            enabled_backends = ceph-0:rbd,ceph-1:rbd,swift-0:swift
            [glance_store]
            default_backend = ceph-1
    ...
  3. 为您要使用的每个后端类型添加配置:

    • 添加第一个 Ceph RBD 存储 ceph-0 的配置:

      ...
            customServiceConfig: |
              [DEFAULT]
              ...
              [ceph-0]
              rbd_store_ceph_conf = /etc/ceph/ceph-0.conf
              store_description = "RBD backend"
              rbd_store_pool = images
              rbd_store_user = openstack
      ...
    • 添加第二个 Ceph RBD 存储 ceph-1 的配置:

      ...
            customServiceConfig: |
              [DEFAULT]
              ...
              [ceph-0]
              ...
              [ceph-1]
              rbd_store_ceph_conf = /etc/ceph/ceph-1.conf
              store_description = "RBD backend 1"
              rbd_store_pool = images
              rbd_store_user = openstack
      ...
    • 添加对象存储服务 store, swift-0 的配置:

      ...
            customServiceConfig: |
              [DEFAULT]
              ...
              [ceph-0]
              ...
              [ceph-1]
              ...
              [swift-0]
              swift_store_create_container_on_put = True
              swift_store_auth_version = 3
              swift_store_auth_address = {{ .KeystoneInternalURL }}
              swift_store_key = {{ .ServicePassword }}
              swift_store_user = service:glance
              swift_store_endpoint_type = internalURL
      ...
  4. 更新 control plane:

    $ oc apply -f openstack_control_plane.yaml -n openstack
  5. 等待 RHOCP 创建与 OpenStackControlPlane CR 相关的资源。运行以下命令来检查状态:

    $ oc get openstackcontrolplane -n openstack

    当状态为 "Setup complete" 时,会创建 OpenStackControlPlane 资源。

    提示

    -w 选项附加到 get 命令的末尾,以跟踪部署进度。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.