Notice
This document is for a development version of Ceph.
Configuring Ceph
Every Ceph Storage Cluster runs at least three types of daemons:
Ceph Monitor (
ceph-mon)Ceph Manager (
ceph-mgr)Ceph OSD Daemon (
ceph-osd)
A Ceph Storage Cluster that deploys the Ceph File System also runs
at least one Ceph Metadata Server (ceph-mds). A cluster that
deploys Ceph Object Storage runs Ceph RADOS Gateway daemons
(radosgw).
Each daemon has a number of configuration options, and each of those options has a default value. Adjust the behavior of the system by changing these configuration options. Make sure to understand the consequences before overriding the default values, as it is possible to significantly degrade the performance and stability of your cluster. Remember that default values sometimes change between releases. For this reason, it is best to review the version of this documentation that applies to your Ceph release. When updating to a new Ceph release, also review the release notes for important changes.
Option Names
Each Ceph configuration option has a unique name that consists of words
formed with lowercase characters and connected with underscore characters
(_). Always write option names with underscores, as this documentation
does. In a configuration file, a name written with dashes, such as
mon-host, is ignored without a warning.
Config Sources
Each Ceph daemon and client pulls configuration option values from one or more of the sources listed below. Option values found via sources later in the list will override any found in sources earlier in the list. In other words, the last value wins.
The compiled-in default value
The central configuration database maintained by the Monitors
A configuration file stored on the local host
Environment variables
Command-line arguments
Runtime overrides set via the admin socket or injection
One of the first things a Ceph process does on startup is parse the configuration options provided via the command line, via the environment, and via the local configuration file. Next, the process contacts the monitor cluster to retrieve centrally-stored configuration for the entire cluster. After a complete set of configuration options is available, the startup of the daemon or process will commence.
Bootstrap Options
Bootstrap options enable each Ceph daemon to contact the Monitors, to authenticate, and to retrieve central configuration values. For this reason, these options are usually stored locally on each node in a local configuration file. These options include the following:
- mon_host
This is a list of IP addresses or hostnames that are separated by commas, whitespace, or semicolons. Hostnames are resolved via DNS. All A and AAAA records are included in the search list.
- type:
str- runtime updatable:
false
- mon_host_override
This is the list of Monitors that the Ceph process initially contacts when first establishing communication with the Ceph cluster. This overrides the known Monitor list that is derived from MonMap updates sent to older Ceph instances (like librados cluster handles). This option is expected to be useful primarily for debugging.
- type:
str- runtime updatable:
false
mon_data,osd_data,mds_data,mgr_data, and similar options that define the local directory in which the daemon stores data.keyring,keyfile, and/orkey, which can be used to specify the authentication credential to use to authenticate with the Monitors. Note that in most cases the default keyring location is in the data directory specified above.
There is usually no reason to modify the default values of these
options. However, there is one exception: the mon_host
option that identifies the addresses of the cluster’s Monitors. When
DNS is used to identify monitors, a local Ceph
configuration file can be avoided entirely.
Skipping Monitor Config
Daemons such as ceph-osd and ceph-mds accept the --no-mon-config
option, which skips the step that retrieves configuration information from
the cluster’s Monitors at startup.
Skipping this config option source can be useful in cases where configuration is
managed entirely via configuration files, or when maintenance is necessary
but the Monitor quorum is down. Once it connects to the Monitors, a daemon
started with the option still applies the central values of options that can
change at runtime. Programs that connect through librados, such as the
ceph command and radosgw, accept the option but still retrieve and
apply the central configuration when they connect.
Configuration Sections
Each configuration option associated with a single process or daemon has a single value. The value for a configuration option may be set for all daemon types or for only daemons of a given type. Ceph options that are stored in the Monitor configuration database or in local configuration files are grouped into configuration sections in order to indicate to which daemons or clients they apply.
These sections include the following:
- global
Settings under
globalaffect all daemons and clients in a Ceph Storage Cluster. In some cases an option may need to be set in one or more sections, for one or more daemons, that is not obvious from its name. In such cases the description of that option may call this out, or in most cases one can select theglobalsection (aka central configwho) to ensure that it is applied to all appropriate daemons or clients.- Example:
log_file = /var/log/ceph/$cluster-$type.$id.log
- mon
Settings under
monaffect allceph-monMonitor daemons in the Ceph Storage Cluster, and override any value set inglobal.- Example:
mon_cluster_log_to_syslog = true
- mgr
Settings in the
mgrsection affect allceph-mgrManager daemons in the Ceph Storage Cluster, and override any value set inglobal.- Example:
mgr_stats_period = 10
- osd
Settings under
osdaffect allceph-osdOSD daemons in the Ceph Storage Cluster, and override any value set inglobal.- Example:
osd_op_queue = wpq
- mds
Settings in the
mdssection affect all CephFSceph-mdsdaemons in the Ceph Storage Cluster, and override any value set inglobal.- Example:
mds_cache_memory_limit = 10G
- client
Settings under
clientaffect all Ceph clients (for example, mounted Ceph File Systems, attached Ceph Block Devices) and daemons including the RADOS Gateway (RGW) and the NVMeoF Gateway.- Example:
objecter_inflight_ops = 512
Configuration sections can also specify a specific daemon or client name. For example,
mon.foo, osd.123, and client.smith are all valid section names.
This granularity is rarely needed: in most cases it is best to apply a setting
to all Monitors, all OSDs (potentially with a mask for a device class), etc.
so that as the cluster grows or the orchestrator changes daemon placement the
expected values remain in force.
Any given daemon will draw settings from the global section, the daemon- or
client-type section, and the section sharing its name. Settings in the
most-specific section take precedence: for example, if the same
option is specified in both global, mon, and mon.foo
on the same source (that is, in the same configuration file), the
mon.foo setting will be used.
If multiple values of the same configuration option are specified in the same section, the last value specified takes precedence.
Note that values set in the local configuration file always take precedence over values from the Monitor central configuration database, regardless of the section in which they appear.
Metavariables
Metavariables dramatically simplify Ceph storage cluster configuration. When a metavariable is set within a configuration value, Ceph expands the metavariable at the time the configuration value is used. In this way, Ceph metavariables behave similarly to the way that variable expansion works in the Bash shell.
Ceph supports the following metavariables:
- $cluster
Expands to the Ceph Storage Cluster name. Useful when running multiple Ceph Storage Clusters on the same hardware. Note that cluster vanity names are deprecated and may be removed entirely from future releases. We strongly urge that new clusters be provisioned only with the default name
cephand that existing clusters with vanity names be retrofitted to the default name.- Example:
/etc/ceph/$cluster.keyring- Default:
ceph
- $type
Expands to a daemon or process type (for example,
mds,osd, ormon)- Example:
/var/lib/ceph/$type
- $id
Expands to the daemon or client identifier. For
osd.0, this would be0; formds.a, it would bea.- Example:
/var/lib/ceph/$type/$cluster-$id
- $host
Expands to the short host name (the output of
hostname -s) of the host where the process is running.
- $num
Expands to the same value as
$id.
- $<option>
The name of any configuration option, preceded by
$, expands to the value of that option. Default values use this: for example, a daemon’sadmin_socketdefaults to$run_dir/$cluster-$name.asok.
- $name
Expands to
$type.$id.- Example:
/var/run/ceph/$cluster-$name.asok
- $pid
Expands to the daemon’s process id (
PID).- Example:
/var/run/ceph/$cluster-$name-$pid.asok
Ceph Configuration File
On startup, a Ceph process reads one configuration file, chosen as follows:
If
-c(--conf) is given, the files that it names, and no others.Otherwise, if the
CEPH_CONFenvironment variable is set, the files that it names, and no others.Otherwise, the first of these that exists:
/etc/ceph/$cluster.conf~/.ceph/$cluster.conf./$cluster.conf(that is, in the current working directory)On FreeBSD systems only,
/usr/local/etc/ceph/$cluster.confOn MS Windows systems only,
$programdata/ceph/$cluster.conf
-c and CEPH_CONF take a list of paths separated by commas or
semicolons, and the first file in the list that can be read is used. If no
file named with -c can be opened, the process exits with an error.
Here $cluster is the cluster’s name (default: ceph).
The Ceph configuration file uses an ini style syntax. One may add comment
text after a pound sign (#) or a semicolon (;). For example:
# A number sign (#) or a semicolon (;) starts a comment.
; A comment may be anything.
# Comments always follow a semicolon (;) or a pound sign (#) on each line.
# The end of the line terminates a comment.
# We recommend that you provide comments in your configuration file(s).
Config File Section Names
The configuration file is divided into sections. Each section must begin with a valid configuration section name (see Configuration Sections, above) within square brackets. For example:
[global]
debug_ms = 0
[osd]
debug_ms = 1
[osd.1]
debug_ms = 10
[osd.2]
debug_ms = 10
Config File Option Values
The value of a configuration option is a string. If the string is too long to
fit on a single line, you may place a backslash (\) at the end of the line
and the backslash will act as a line continuation marker. The text of the next
line is joined to the current line exactly as written, with no space added.
Here is an example:
[global]
foo = long long ago \
long ago
In this example, the value of the “foo” option is “long long ago long
ago”, because there is a space before the backslash. Without that space, the
value would be “long long agolong ago”. Be careful to not place a
backslash at the end of the final line of the multi-line string.
An option value setting in a local config file ends with a newline.
A comment prefixed with # may be added before the newline.
Examples:
[global]
obscure_one = difficult to explain # I will try harder in next release
simpler_one = nothing to explain
In this example, the value of the “obscure_one” option is “difficult to
explain” and the value of the “simpler_one” option is “nothing to
explain”.
Quotes are optional, and an unquoted value keeps the spaces inside it. A value
may be enclosed in single or double quotes; inside quotes, write the quote
character as \" or \'. For example:
[global]
line = "to be, or not to be"
The characters # and ; start a comment. To use either of them in a
value, inside quotes or not, escape it with a backslash (\# or \;).
Inside quotes, an unescaped # or ; makes the whole file invalid. A
backslash followed by any other character stands for that character, so write
a literal backslash as \\. Other characters, including = and [,
can be used in a value without escaping.
Example:
[global]
secret = "I l0ve \# and ["
Each configuration option specifies one of the following types for its value:
- int
A 64-bit signed integer. The suffixes
K,M,G,T,P, andEmultiply the value by 103, 106, 109, 1012, 1015, and 1018. No other suffix is accepted, not evenB:1K,1M, and-1are valid values, and128Bis not. When a negative value is assigned to an option that defines a threshold or limit, this often indicates that the value is “unlimited”: no threshold or limit is enforced. Options that allow such a value will usually indicate so in their individual description text.- Example:
42,-1
- uint
An unsigned integer, which differs from
intonly in that negative values are not permitted.- Example:
256,0
- float
A decimal number.
- Example:
0.95,1e-3
- str
A string encoded in UTF-8. Certain characters are not permitted. Reference the above notes for details.
- Example:
"hello world","i love \#",yet-another-name
- bool
Typically either
trueorfalse. However, any integer is permitted: “0” impliesfalse, and any non-zero value impliestrue. We encourage the use oftrueorfalsefor clarity.- Example:
true,false,1,0
- addr
A single address, optionally prefixed with
v1,v2oranyfor the messenger protocol. If no prefix is specified, thev2protocol is used. An IPv6 address followed by a port must be enclosed in brackets. For more details, see Address formats.- Example:
v1:1.2.3.4:567,v2:1.2.3.4:567,1.2.3.4:567,[2001:db8::1]:3300,[::1]:6789
- addrvec
A list of addresses separated by commas (
,) with no spaces, and enclosed in[and]. Without the brackets, only the first address is used.- Example:
[v1:1.2.3.4:567,v2:1.2.3.4:568],[v1:1.2.3.4:567,v1:1.2.3.14:567],[v2:[2001:db8::1]:3300,v1:[2001:db8::1]:6789]
- uuid
A UUID string in the format defined by RFC 9562 (which obsoletes RFC 4122). Certain variants are also supported. For more details, see this Boost document.
- Example:
f81d4fae-7dec-11d0-a765-00a0c91e6bf6
- size
A 64-bit unsigned integer, usually a number of bytes. The suffixes
K,M,G,T,P, andEmultiply the value by powers of 1024, with or withoutiand with or without a trailingB:1K,1Ki,1KB, and1KiBall mean 1024.Balone means bytes. Negative values are not permitted.- Example:
1Ki,1K,1KiBand1B.
- secs
Denotes a duration of time. The default unit of time is the second. The following units of time are supported:
second:
s,sec,second,secondsminute:
m,min,minute,minuteshour:
h,hr,hour,hoursday:
d,day,daysweek:
w,wk,week,weeksmonth:
mo,month,monthsyear:
y,yr,year,years
Several values can be combined, for example
1h 30m.- Example:
1 m,1mand1 week
- millisecs
A duration in milliseconds, given as a whole number with no unit.
- Example:
500
Monitor configuration database
The Monitors manage a database of configuration options that can be
consumed by the entire cluster. This allows for streamlined central
configuration of the entire system. For ease of administration,
transparency, and to avoid inconsistencies, the vast majority of configuration options can and should be
set in this database instead of in ceph.conf files on daemon or
client nodes.
A few specific settings might need to be stored in local configuration files because they
affect the ability of the process to connect to the Monitors, to authenticate,
and to fetch additional configuration information. In most cases this applies only to the
mon_host option. This issue can be avoided by using DNS SRV
records if your DNS infrastructure is very robust and
under your control.
Sections and Masks
Configuration options stored by the Monitors can be stored in a global section, in a daemon-type section, or in a specific daemon section. In this sense they are no different than options set in a node-local configuration file, subject to the above source precedence.
In addition, options may have a mask associated with them to further restrict to which daemons or clients the option’s value applies. Masks take two forms:
type:locationwheretypeis a CRUSH bucket type, for examplerackorhost, andlocationis the name of a bucket of that type. Ahost:foomask applies the option to the OSDs under the CRUSH hostfoo. Recent Ceph releases provide functionality that obviates most situations that formerly required host-specific configuration values. Examples include OSD device classes, theosd_memory_targetautotuner, and options with values that are specific to certain media. Examples of the latter includeosd_recovery_sleep_ssdandosd_recovery_max_active_hdd.class:device-classwheredevice-classis the name of a CRUSH device class (for example,hddorssd). For example,class:ssdwould limit the option only to OSDs built solely on SAS, SATA, and NVMe SSDs. This mask has no effect on non-OSD daemons or clients
In commands that specify a configuration option, the argument of the option (in
the following examples, this is the who string) may be a section name, a
mask, or a combination of both separated by a slash character (/). For
example, osd/rack:foo would refer to all OSD daemons under the foo CRUSH rack bucket.
When configuration options are displayed, the section name and any mask are presented in separate fields or columns to make them more readable.
Manager Module Options
Configuration options for Manager modules have names of the form
mgr/<module>/<option>, for example mgr/cephadm/daemon_cache_timeout.
Manager modules read their options only from the Monitor configuration
database, so set them with a command of the following form:
ceph config set mgr mgr/<module>/<option> <value>
A Manager module does not see options of this form in a daemon’s local
ceph.conf file. To copy options from a ceph.conf file into the
Monitor configuration database, use ceph config assimilate-conf, which is
described in Configuration Commands. The command copies every option in
the file that the Monitors can manage, not only Manager module options, and it
does not change the file. The file passed to cephadm bootstrap --config is
handled this way: during bootstrap, cephadm copies its options into the
Monitor configuration database.
Some Manager modules also keep data, such as keys and credentials, in the
separate key-value store that ceph config-key manages, under names that
also begin with mgr/<module>/. These entries are not configuration
options: list them with ceph config-key ls rather than ceph config ls,
and set them with ceph config-key set.
Configuration Commands
The following CLI commands are used to configure the cluster:
ceph config dumpdumps the entire Monitor central configuration database.ceph config lslists the names of all configuration options, including Manager module options. Option names do not form a hierarchy, so no command lists the options under a partial name. Filter the list withgrepinstead:ceph config ls | grep ^osd_recovery ceph config ls | grep ^mgr/balancer/
Only Manager module options contain slashes, in names of the form
mgr/<module>/<option>.ceph config get <who>dumps the configuration options stored in the Monitor configuration database for a specific daemon or client (for example,mds.a).<who>names a daemon or client, such asosd.1orclient.admin, or a type of daemon or client, such asosd.globalis a section of the database, not a daemon or client, soceph config get globalfails withunrecognized entity 'global'even thoughceph config set globalworks. To see the values stored inglobal, runceph config dumpand look forglobalin theWHOcolumn.ceph config get <who> <option>shows either a configuration value stored in the Monitor configuration database for a specific daemon or client (for example,mds.a), or, if that value is not present in the Monitor configuration database, the compiled-in default value.ceph config set <who> <option> <value>sets a configuration option in the Monitor’s configuration database. If a value for this option was previously set, it will be overwritten. Take care to set values with appropriatewhoand optional mask attributes. If, for example, a value exists with thewhoscope ofosdfor thesomeoptionoption, then a command of the formceph config set global someoption somevalueis executed, the central database will retain both. This may be useful in certain situations, but it can lead to confusion and is often best avoided.ceph config show <who>shows configuration values for a running daemon. These settings might differ from those stored by the monitors if there are also local configuration files in use or if options have been overridden on the command line or at runtime via admin socket,ceph tell, orceph daemoncommands. The source of each option value is displayed.ceph config show-with-defaults <who>is like the above, but also shows all defaults, and for changed values, where they are changed.ceph config generate-minimal-confgenerates a minimalceph.conffile necessary to bootstrap connections to the cluster. Further configuration can be done via theceph configinterface.Note
Some configs only affect startup behavior for clients or daemons. In that case, modifying the local
ceph.confis required.ceph config assimilate-conf -i <input_file> -o <output_file>ingests a configuration file from input_file and stores its options in the Monitor configuration database. Options that are unrecognized, that cannot be parsed, that the Monitors cannot store, or that already have a different value in the same section of the database are not imported; they are written to output_file as an abbreviated configuration file. Options already stored with the same value are left as they are. This command is useful when transitioning from legacy configuration files to centralized Monitor-based configuration.ceph-conf --show-configis a legacy command.
Note that ceph config get <who> [<option>] and ceph config show
<who> will not necessarily return the same values. The former shows what the
Monitor configuration database holds for that daemon or client and, when one
option is requested that the database does not hold, its compiled-in default.
The latter shows the values that the running daemon reports, whatever their
source. In order to determine whether a
configuration option is present in the Monitor configuration database, run
ceph config dump.
Help
To get help for a particular option, run the following command:
ceph config help <option>
For example:
ceph config help log_file
log_file - path to log file
(str, basic)
Default (non-daemon):
Default (daemon): /var/log/ceph/$cluster-$name.log
Can update at runtime: false
See also: [log_to_file,log_to_stderr,err_to_stderr,log_to_syslog,err_to_syslog]
or:
ceph config help log_file -f json-pretty
{
"name": "log_file",
"type": "str",
"level": "basic",
"desc": "path to log file",
"long_desc": "",
"default": "",
"daemon_default": "/var/log/ceph/$cluster-$name.log",
"tags": [],
"services": [],
"see_also": [
"log_to_file",
"log_to_stderr",
"err_to_stderr",
"log_to_syslog",
"err_to_syslog"
],
"enum_values": [],
"min": "",
"max": "",
"can_update_at_runtime": false,
"flags": []
}
The level property of each option is basic, advanced, or dev. Options
tagged with the dev level are intended for use by developers for testing purposes, and
Ceph admins (operators) are urged to not change their values without expert-level understanding
or advice from expert support professionals.
Note
This command uses the configuration schema that is compiled into the running Monitors. If you have a mixed-version cluster (as might exist during an upgrade), you might want to query the option schema from a specific running daemon by running a command of the following form:
ceph daemon <name> config help [option]
Note
The Ceph release versions of running daemons may be reported by
running the ceph versions commands. If your cluster is not in the
process of an upgrade, all daemons should show the same version. If multiple
versions are reported outside of an upgrade, a prior upgrade may have failed
or manual changes may have been executed, and the circumstances should be
examined and an upgrade to harmonize versions should be considered.
Runtime Changes
In most cases, runtime changes to the configuration of a daemon take effect without requiring that the daemon be restarted. This might be used for increasing or decreasing the amount of logging output, for temporarily raising or lowering log subsystem debug levels, or for runtime optimization.
Use the ceph config set command to update configuration options. For
example, to raise the messenger debug level of a specific OSD to 20, run a
command of the following form:
ceph config set osd.1701 debug_ms 20
Note
If an option has been customized in a local configuration file, the central config setting will be ignored because it has a lower precedence than the local configuration file.
Note
Debug levels take the form N or N/M, where N and M
are integers from 0 to 99. Most messages are logged at levels up to 20;
some messenger, OSD and BlueStore messages use levels 25, 30 and 40.
Override Values
Runtime option values can be set temporarily by using the ceph tell
or ceph daemon CLI commands. This process is known as injection.
These override values are ephemeral, which means
that they affect only the current instance of the daemon and revert to
persistently configured values when the daemon restarts. Thus they are
useful for careful testing of option value adjustments, but take care to
also persist permanent changes via ceph config set.
Override values can be set in two ways:
From any host, send a message to a daemon with a command of the following form:
ceph tell <name> config set <option> <value>For example:
ceph tell osd.1701 config set debug_osd 20The
tellcommand can also accept a wildcard as the daemon identifier. For example, to adjust the debug level on all OSD daemons, run a command of the following form:ceph tell 'osd.*' config set debug_osd 20On the host where a specific daemon is running, connect to the daemon through its admin socket. On hosts deployed from packages the socket is in
/var/run/ceph. On hosts managed by cephadm it is in/var/run/ceph/<fsid>, which cephadm mounts at/var/run/cephinside its containers, so run the command fromcephadm shellon that host. Run a command of the following form:ceph daemon <name> config set <option> <value>For example:
ceph daemon osd.4 config set debug_osd 20
Note
In the output of the ceph config show command, these temporary
values are shown to have a source of override.
Viewing Runtime Settings
You can see the current settings specified for a running daemon with the ceph
config show command. For example, to see the (non-default) settings for the
daemon osd.1701, run the following command:
ceph config show osd.1701
To see only the value of a single option for a specific daemon, run a command of following form:
ceph config show osd.1701 debug_osd
To see all settings for a specific daemon (including the settings with default values), run a command of the following form:
ceph config show-with-defaults osd.1701
You can show all settings for a daemon that is currently running by connecting
to the admin socket on the host where it runs. For example, to dump all
current settings for osd.1701, run the following command on the host
where osd.1701 runs. The host where a daemon runs can be determined with
the ceph osd find command or ceph orch ps commands.
ceph daemon osd.1701 config show
To see non-default settings and to see the source of each value came (for example, a config file, the central Monitor DB, or an override), run a command of the following form:
ceph daemon osd.1701 config diff
To see the value of a single option, run a command of the following form:
ceph daemon osd.1701 config get debug_osd
Changes Introduced in Octopus
The Octopus release changed the way that the configuration file is parsed. These changes are as follows:
Repeated configuration options are allowed, and no warnings will be displayed. This means that the value that comes last in the file is the one that takes effect. Prior to this change, Ceph displayed warning messages of the following form when lines containing duplicate options were encountered:
warning line 42: 'foo' in section 'bar' redefined
Prior to Octopus, options containing invalid UTF-8 characters were ignored with warning messages. In Octopus and later releases they are treated as fatal errors.
The backslash character
\is interpreted as a line-continuation marker that combines the next line with the current one. Prior to Octopus, there was a requirement that any end-of-line backslash be followed by a non-empty line. In Octopus and later releases, an empty line following a backslash is allowed.In the configuration file, each line specifies an individual configuration option. The option’s name and its value are separated with
=, and the value may be enclosed within single or double quotes. A line that cannot be parsed makes the whole file invalid, and the error names the line and the position, for example:global_init: error reading config file. parse error: expected '<eoi>' in line 2 at position 1
Prior to Octopus, if no section name was specified in the configuration file, all options would be set as though they were within the
globalsection. This approach is discouraged. Since Octopus, any configuration file that has no section name must contain only a single option.
Brought to you by the Ceph Foundation
The Ceph Documentation is a community resource funded and hosted by the non-profit Ceph Foundation. If you would like to support this and our other efforts, please consider joining now.