1.2. 配置文件结构
Ceph 配置文件在启动时配置 Ceph 守护进程,覆盖默认值。Ceph 配置文件采用一种 格式 的语法。您可以在前面的注释中用井号 (#) 或分号 (;) 添加注释。例如:
<--A number (#) 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 number (#) sign precedes a comment.
; A comment may be anything.
# 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).
配置文件可以在 Ceph 存储集群中配置所有 Ceph 守护进程,或者在启动时配置特定类型的所有 Ceph 守护进程。要配置一系列守护进程,必须在接收配置的进程中包含设置,如下所示:
- [global]
- 描述
-
[global]
下的设置会影响 Ceph Storage 集群中的所有守护进程。 - 示例
-
auth supported = cephx
- [osd]
- 描述
-
[osd]
下的设置会影响 Ceph 存储集群中的所有ceph-osd
守护进程,并覆盖[global]
中的相同设置。 - 示例
-
OSD 日志大小 = 1000
- [mon]
- 描述
-
[mon]
下的设置会影响 Ceph 存储集群中的所有ceph-mon
守护进程,并覆盖[global]
中的相同设置。 - 示例
-
mon host = hostname1,hostname2,hostname3
mon addr = 10.0.0.101:6789
- [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_journal_size = 1000
[osd]
osd_journal_size = 1000
您可以为守护进程的特定实例指定设置。您可以通过输入类型,以句点 (.) 分隔来指定一个实例,或通过实例 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 配置文件位置按顺序包括:
-
$CEPH_CONF
(跟随$CEPH_CONF
环境变量的路径) -
-c path/path
(-c
命令行参数) -
/etc/ceph/ceph.conf
-
~/.ceph/config
-
./Ceph.conf
(在当前工作目录中)
典型的 Ceph 配置文件至少具有以下设置: