Skip to content

Commit d37aa58

Browse files
authored
Merge pull request ceph#56592 from nh2/crush-location-doc-fixes
doc/rados/operations: Improve crush_location docs Reviewed-by: Anthony D'Atri <[email protected]> Reviewed-by: Zac Dover <[email protected]>
2 parents 9ad0cef + d91e75e commit d37aa58

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

doc/rados/operations/crush-map.rst

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,53 +57,62 @@ case for most clusters), its CRUSH location can be specified as follows::
5757
``pod``, ``pdu``, ``rack``, ``chassis``, and ``host``. These defined
5858
types suffice for nearly all clusters, but can be customized by
5959
modifying the CRUSH map.
60-
#. Not all keys need to be specified. For example, by default, Ceph
61-
automatically sets an ``OSD``'s location as ``root=default
62-
host=HOSTNAME`` (as determined by the output of ``hostname -s``).
6360

64-
The CRUSH location for an OSD can be modified by adding the ``crush location``
65-
option in ``ceph.conf``. When this option has been added, every time the OSD
61+
The CRUSH location for an OSD can be set by adding the ``crush_location``
62+
option in ``ceph.conf``, example:
63+
64+
crush_location = root=default row=a rack=a2 chassis=a2a host=a2a1
65+
66+
When this option has been added, every time the OSD
6667
starts it verifies that it is in the correct location in the CRUSH map and
6768
moves itself if it is not. To disable this automatic CRUSH map management, add
6869
the following to the ``ceph.conf`` configuration file in the ``[osd]``
6970
section::
7071

71-
osd crush update on start = false
72+
osd_crush_update_on_start = false
7273

7374
Note that this action is unnecessary in most cases.
7475

76+
If the ``crush_location`` is not set explicitly,
77+
a default of ``root=default host=HOSTNAME`` is used for ``OSD``s,
78+
where the hostname is determined by the output of the ``hostname -s`` command.
79+
80+
.. note:: If you switch from this default to an explicitly set ``crush_location``,
81+
do not forget to include ``root=default`` because existing CRUSH rules refer to it.
7582

7683
Custom location hooks
7784
---------------------
7885

79-
A custom location hook can be used to generate a more complete CRUSH location
80-
on startup. The CRUSH location is determined by, in order of preference:
86+
A custom location hook can be used to generate a more complete CRUSH location,
87+
on startup.
88+
89+
This is useful when some location fields are not known at the time
90+
``ceph.conf`` is written (for example, fields ``rack`` or ``datacenter``
91+
when deploying a single configuration across multiple datacenters).
8192

82-
#. A ``crush location`` option in ``ceph.conf``
83-
#. A default of ``root=default host=HOSTNAME`` where the hostname is determined
84-
by the output of the ``hostname -s`` command
93+
If configured, executed, and parsed successfully, the hook's output replaces
94+
any previously set CRUSH location.
8595

86-
A script can be written to provide additional location fields (for example,
87-
``rack`` or ``datacenter``) and the hook can be enabled via the following
88-
config option::
96+
The hook hook can be enabled in ``ceph.conf`` by providing a path to an
97+
executable file (often a script), example::
8998

90-
crush location hook = /path/to/customized-ceph-crush-location
99+
crush_location_hook = /path/to/customized-ceph-crush-location
91100

92101
This hook is passed several arguments (see below). The hook outputs a single
93-
line to ``stdout`` that contains the CRUSH location description. The output
94-
resembles the following:::
102+
line to ``stdout`` that contains the CRUSH location description. The arguments
103+
resemble the following:::
95104

96105
--cluster CLUSTER --id ID --type TYPE
97106

98107
Here the cluster name is typically ``ceph``, the ``id`` is the daemon
99108
identifier or (in the case of OSDs) the OSD number, and the daemon type is
100-
``osd``, ``mds, ``mgr``, or ``mon``.
109+
``osd``, ``mds``, ``mgr``, or ``mon``.
101110

102111
For example, a simple hook that specifies a rack location via a value in the
103-
file ``/etc/rack`` might be as follows::
112+
file ``/etc/rack`` (assuming it contains no spaces) might be as follows::
104113

105114
#!/bin/sh
106-
echo "host=$(hostname -s) rack=$(cat /etc/rack) root=default"
115+
echo "root=default rack=$(cat /etc/rack) host=$(hostname -s)"
107116

108117

109118
CRUSH structure

0 commit comments

Comments
 (0)