配置 Ceph 客户端(可选)¶
Ceph 是一种大规模可扩展、开源、分布式存储系统。
这些链接提供了有关如何在 OpenStack 中使用 Ceph 的详细信息
Ceph - OpenStack 事实上的存储后端 (香港峰会演讲)
注意
配置 Ceph 存储服务器不在本文档的范围内。
身份验证¶
我们建议在 Ceph 配置参考 中使用 cephx 认证方法。OpenStack-Ansible 默认情况下为 Ceph 客户端启用 cephx。您可以使用 cephx Ansible 变量来覆盖此设置
cephx: False
如果禁用 cephx,请在受信任的网络上部署 Ceph。
配置文件覆盖¶
OpenStack-Ansible 提供了 ceph_conf_file 变量。这允许您指定配置文件选项以覆盖默认的 Ceph 配置
ceph_conf_file: |
[global]
fsid = 4037aa5f-abde-4378-9470-f73dbd6ceaba
mon_initial_members = mon1.example.local,mon2.example.local,mon3.example.local
mon_host = 172.29.244.151,172.29.244.152,172.29.244.153
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
使用 ceph_conf_file 变量是可选的。默认情况下,OpenStack-Ansible 从您的 Ceph 监控器之一获取 ceph.conf 的副本。这种 ceph.conf 的传输需要将 OpenStack-Ansible 部署主机的公钥部署到所有 Ceph 监控器。更多详细信息请参见:部署 SSH 密钥。
以下最小示例配置将 nova 和 glance 设置为使用 ceph 池:分别为 ephemeral-vms 和 images。该示例使用 cephx 认证,并需要为 images 和 ephemeral-vms 池的现有 glance 和 cinder 帐户。
glance_default_store: rbd
nova_libvirt_images_rbd_pool: ephemeral-vms
有关如何提供必要的配置以使用 Ceph 后端而无需通过 SSH 访问 Ceph 监控器的完整示例,请参阅 从文件示例的 Ceph keyring。
额外的客户端配置文件¶
部署者可以通过 ceph_extra_confs 变量指定额外的 Ceph 配置文件以支持多个 Ceph 集群后端。
ceph_extra_confs:
- src: "/opt/rdb-1.conf"
dest: "/etc/ceph/rdb-1.conf"
- src: "/opt/rdb-2.conf"
dest: "/etc/ceph/rdb-2.conf"
这些配置文件源必须存在于部署主机上。
或者,部署者可以在 ceph_extra_confs 中指定更多选项以部署 keyring、ceph.conf 文件并配置 libvirt 密钥。
ceph_extra_confs:
- src: "/etc/openstack_deploy/ceph2.conf"
dest: "/etc/ceph/ceph2.conf"
mon_host: 192.168.1.2
client_name: cinder2
keyring_src: /etc/openstack_deploy/ceph2.client.cinder2.keyring
keyring_dest: /etc/ceph/ceph2.client.cinder2.keyring
secret_uuid: '{{ cinder_ceph_client_uuid2 }}'
- src: "/etc/openstack_deploy/ceph3.conf"
dest: "/etc/ceph/ceph3.conf"
mon_host: 192.168.1.3
client_name: cinder3
keyring_src: /etc/openstack_deploy/ceph3.client.cinder3.keyring
keyring_dest: /etc/ceph/ceph3.client.cinder3.keyring
secret_uuid: '{{ cinder_ceph_client_uuid3 }}'
此功能的主要目的是将多个 ceph 集群作为 cinder 后端部署,并使 nova/libvirt 能够从这些后端挂载块卷。这些设置不会覆盖 ceph 客户端的正常部署和相关的设置任务。
将多个 ceph 集群作为 cinder 后端部署需要对 cinder_backends 中的每个后端进行以下调整
rbd_ceph_conf: /etc/ceph/ceph2.conf
rbd_pool: cinder_volumes_2
rbd_user: cinder2
rbd_secret_uuid: '{{ cinder_ceph_client_uuid2 }}'
volume_backend_name: volumes2
字典键 rbd_ceph_conf、rbd_user 和 rbd_secret_uuid 必须对用作 cinder_backend 的每个 ceph 集群是唯一的。
监控器¶
Ceph 监控器 维护集群地图的主副本。OpenStack-Ansible 提供了 ceph_mons 变量,并期望在部署中提供 Ceph 监控器服务器的 IP 地址列表
ceph_mons:
- 172.29.244.151
- 172.29.244.152
- 172.29.244.153
使用 ceph_client 配置 os_gnocchi¶
如果 os_gnocchi 角色将要利用 ceph_client 角色,则需要将以下配置添加到用户变量文件中
ceph_extra_components:
- component: gnocchi_api
package: "{{ python_ceph_packages }}"
client:
- name: '{{ gnocchi_ceph_client }}'
service: '{{ ceph_gnocchi_service_names }}'