1.4. Ceph 配置文件
Ceph 配置文件在启动时配置 Ceph 守护进程,这将覆盖其默认值。
每个 Ceph 守护进程都有一系列默认值,由 ceph/src/common/config_opts.h
文件设置。
Ceph 默认配置文件的位置为 /etc/ceph/ceph.conf
。您可以通过设置不同的路径来更改该位置:
-
设置
$CEPH_CONF
环境变量中的路径。 -
指定
-c
命令行参数,例如-c path/ceph.conf
。
Ceph 配置文件采用一种 格式 的语法。您可以在前面的注释中用井号 (#) 或分号 (;) 添加注释。
示例
<--A pound sign (#) sign precedes a comment. Comments always follow a semi-colon (;) or a pound (#) on each line. The end of the line terminates a comment. We recommend that you provide comments in your configuration file(s).
# <--A pound sign (#) sign precedes a comment.
# Comments always follow a semi-colon (;) or a pound (#) on each line.
# The end of the line terminates a comment.
# We recommend that you provide comments in your configuration file(s).
; A comment may be anything.
配置文件可以在 Ceph 存储集群中配置所有 Ceph 守护进程,或者在启动时配置特定类型的所有 Ceph 守护进程。要配置一系列守护进程,必须在接收配置的进程中包含设置,如下所示:
[global]
- 描述
-
[global]
下的设置会影响 Ceph Storage 集群中的所有守护进程。 - 示例
-
auth supported = cephx
[osd]
- 描述
-
[osd]
下的设置会影响 Ceph 存储集群中的所有ceph-osd
守护进程,并覆盖[global]
中的相同设置。
[mon]
- 描述
-
[mon]
下的设置会影响 Ceph 存储集群中的所有ceph-mon
守护进程,并覆盖[global]
中的相同设置。 - 示例
[client]
- 描述
-
[client]
下的设置会影响所有 Ceph 客户端。例如,挂载的 Ceph 块设备、Ceph 对象网关等。 - 示例
-
log file = /var/log/ceph/radosgw.log
全局设置会影响 Ceph 存储集群中所有守护进程的所有实例。将 [global]
标题用于 Ceph 存储集群中所有守护进程通用的值。您可以通过以下方式覆盖每个 [global]
选项:
更改特定进程类型的选项:
示例
[OSD]
,[mon]
或者
更改特定进程的选项:
示例
[osd.1]
覆盖全局设置会影响所有子进程,除了您在特定守护进程中特别覆盖的子进程。
典型的全局设置涉及激活身份验证。
示例
[global] #Enable authentication between hosts within the cluster. auth_cluster_required = cephx auth_service_required = cephx auth_client_required = cephx
[global]
#Enable authentication between hosts within the cluster.
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
您可以指定适用于特定类型的守护进程的设置。当您指定 [osd]
或 [mon]
下的设置而不指定特定实例,则设置将分别应用于所有 OSD 或监控守护进程。全守护进程设置的示例是 osd 内存目标。
示例
[osd] osd_memory_target = 5368709120
[osd]
osd_memory_target = 5368709120
您可以为守护进程的特定实例指定设置。您可以通过输入类型,以句点 (.) 分隔来指定一个实例,或通过实例 ID 来指定实例。Ceph OSD 守护进程的实例 ID 始终是数字,但 Ceph 监视器可能会是字母数字。
示例
[osd.1] # settings affect osd.1 only. [mon.a] # settings affect mon.a only.
[osd.1]
# settings affect osd.1 only.
[mon.a]
# settings affect mon.a only.
典型的 Ceph 配置文件至少具有以下设置:
示例