ceph存储集群运行需要osd和mon模块, 如果要使用对象存储, 需要添加radosgw模块, 如果需要使用ceph 文件系统需要添加mds模块.
这些模块在启动时, 需要读取配置文件, ceph所有类型的daemon配置文件统一放在一个配置文件中, 配置文件的顺序如下 :
The default Ceph configuration file locations in sequential order include:
$CEPH_CONF (i.e., the path following the $CEPH_CONF environment variable)
-c path/path (i.e., the -c command line argument)
/etc/ceph/ceph.conf
~/.ceph/config
./ceph.conf (i.e., in the current working directory)
以上配置文件ceph.conf指集群名为ceph的配置文件, 如果集群名为其他如openstack, 那么配置文件名为openstack.conf.
在配置文件中未配置的参数, CEPH在头文件中定义了一些默认值, 默认值在如下文件中定义 :
Ceph存储集群的配置包含哪些内容呢? 大致如下 :
配置文件注释, ;或#开头. 例如 :
ceph/src/common/config_opts.h
Ceph存储集群的配置包含哪些内容呢? 大致如下 :
Cluster Identity (uuid)
Authentication settings 认证
Cluster membership
Host names
Host addresses
Paths to keyrings KEY文件路径
Paths to journals osd journal路径
Paths to data DATA路径
Other runtime options
配置文件注释, ;或#开头. 例如 :
# <--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存储集群daemon使用同一个配置文件, 那么要区分不同daemon的配置, 使用section来区分.
例如 :
针对daemon还支持不同的instance使用不同的配置, 例如一台机器启动了多个osd daemon, 可以对每个daemon配置不同的参数.
优先级
全局配置, 一般用于配置公共项, 可以被其他章节的配置覆盖.
[global]
Description: Settings under [global] affect all daemons in a Ceph Storage Cluster.
Example: auth supported = cephx
object storage devices daemon配置
[osd]
Description: Settings under [osd] affect all ceph-osd daemons in the Ceph Storage Cluster, and override the same setting in [global].
Example: osd journal size = 1000
monitor daemon配置
[mon]
Description: Settings under [mon] affect all ceph-mon daemons in the Ceph Storage Cluster, and override the same setting in [global].
Example: mon addr = 10.0.0.101:6789
metadata storage daemon配置
[mds]
Description: Settings under [mds] affect all ceph-mds daemons in the Ceph Storage Cluster, and override the same setting in [global].
Example: host = myserver01
客户端配置
[client]
Description: Settings under [client] affect all Ceph Clients (e.g., mounted Ceph Filesystems, mounted Ceph Block Devices, etc.).
Example: log file = /var/log/ceph/radosgw.log
针对daemon还支持不同的instance使用不同的配置, 例如一台机器启动了多个osd daemon, 可以对每个daemon配置不同的参数.
You may specify settings for particular instances of a daemon. You may specify an instance by entering its type, delimited by a period (.) and by the instance ID. The instance ID for a Ceph OSD Daemon is always numeric, but it may be alphanumeric for Ceph Monitors and Ceph Metadata Servers.
[osd.1]
# settings affect osd.1 only.
[mon.a]
# settings affect mon.a only.
[mds.b]
# settings affect mds.b only.
# osd instance id必须是数字, mon和mds的instance可以是数字字母.
# 客户端配置同样支持不同的客户端使用不同的配置.
[client.radosgw.instance-name]
# settings affect client.radosgw.instance-name only.
优先级
全局 配置<daemon 配置<daemon.process 配置
优先级高的配置将覆盖优先级低的配置.
配置文件中可以使用的变量, 包括集群名, daemon类型, instance id, 主机名, daemon_instance_id组合. :
[参考]
Metavariables simplify Ceph Storage Cluster configuration dramatically. When a metavariable is set in a configuration value, Ceph expands the metavariable into a concrete value. Metavariables are very powerful when used within the [global], [osd], [mon], [mds] or [client] sections of your configuration file. Ceph metavariables are similar to Bash shell expansion.
Ceph supports the following metavariables:
$cluster
Description: Expands to the Ceph Storage Cluster name. Useful when running multiple Ceph Storage Clusters on the same hardware.
Example: /etc/ceph/$cluster.keyring
Default: ceph
$type
Description: Expands to one of mds, osd, or mon, depending on the type of the instant daemon.
Example: /var/lib/ceph/$type
$id
Description: Expands to the daemon identifier. For osd.0, this would be 0; for mds.a, it would be a.
Example: /var/lib/ceph/$type/$cluster-$id
$host
Description: Expands to the host name of the instant daemon.
$name
Description: Expands to $type.$id.
Example: /var/run/ceph/$cluster-$name.asok
[参考]