Chapter 3. Monitoring a Ceph storage cluster
As a storage administrator, you can monitor the overall health of the Red Hat Ceph Storage cluster, along with monitoring the health of the individual components of Ceph.
Once you have a running Red Hat Ceph Storage cluster, you might begin monitoring the storage cluster to ensure that the Ceph Monitor and Ceph OSD daemons are running, at a high-level. Ceph storage cluster clients connect to a Ceph Monitor and receive the latest version of the storage cluster map before they can read and write data to the Ceph pools within the storage cluster. So the monitor cluster must have agreement on the state of the cluster before Ceph clients can read and write data.
Ceph OSDs must peer the placement groups on the primary OSD with the copies of the placement groups on secondary OSDs. If faults arise, peering will reflect something other than the active + clean
state.
3.1. Prerequisites
- A running Red Hat Ceph Storage cluster.
3.2. High-level monitoring of a Ceph storage cluster
As a storage administrator, you can monitor the health of the Ceph daemons to ensure that they are up and running. High level monitoring also involves checking the storage cluster capacity to ensure that the storage cluster does not exceed its full ratio
. The Red Hat Ceph Storage Dashboard is the most common way to conduct high-level monitoring. However, you can also use the command-line interface, the Ceph admin socket or the Ceph API to monitor the storage cluster.
3.2.1. Prerequisites
- A running Red Hat Ceph Storage cluster.
3.2.2. Using the Ceph command interface interactively
You can interactively interface with the Ceph storage cluster by using the ceph
command-line utility.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To run the
ceph
utility in interactive mode.Bare-metal deployments:
Example
[root@mon ~]# ceph ceph> health ceph> status ceph> quorum_status ceph> mon_status
Container deployments:
Red Hat Enterprise Linux 7
docker exec -it ceph-mon-MONITOR_NAME /bin/bash
Red Hat Enterprise Linux 8
podman exec -it ceph-mon-MONITOR_NAME /bin/bash
- Replace
MONITOR_NAME with the name of the Ceph Monitor container, found by running the
docker ps
orpodman ps
command respectively.Example
[root@container-host ~]# podman exec -it ceph-mon-mon01 /bin/bash
This example opens an interactive terminal session on
mon01
, where you can start the Ceph interactive shell.
3.2.3. Checking the storage cluster health
After you start the Ceph storage cluster, and before you start reading or writing data, check the storage cluster’s health first.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
You can check on the health of the Ceph storage cluster with the following:
[root@mon ~]# ceph health
If you specified non-default locations for the configuration or keyring, you can specify their locations:
[root@mon ~]# ceph -c /path/to/conf -k /path/to/keyring health
Upon starting the Ceph cluster, you will likely encounter a health warning such as HEALTH_WARN XXX num placement groups stale
. Wait a few moments and check it again. When the storage cluster is ready, ceph health
should return a message such as HEALTH_OK
. At that point, it is okay to begin using the cluster.
3.2.4. Watching storage cluster events
You can watch events that are happening with the Ceph storage cluster using the command-line interface.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To watch the cluster’s ongoing events on the command line, open a new terminal, and then enter:
[root@mon ~]# ceph -w
Ceph will print each event. For example, a tiny Ceph cluster consisting of one monitor and two OSDs may print the following:
cluster b370a29d-9287-4ca3-ab57-3d824f65e339 health HEALTH_OK monmap e1: 1 mons at {ceph1=10.0.0.8:6789/0}, election epoch 2, quorum 0 ceph1 osdmap e63: 2 osds: 2 up, 2 in pgmap v41338: 952 pgs, 20 pools, 17130 MB data, 2199 objects 115 GB used, 167 GB / 297 GB avail 952 active+clean 2014-06-02 15:45:21.655871 osd.0 [INF] 17.71 deep-scrub ok 2014-06-02 15:45:47.880608 osd.1 [INF] 1.0 scrub ok 2014-06-02 15:45:48.865375 osd.1 [INF] 1.3 scrub ok 2014-06-02 15:45:50.866479 osd.1 [INF] 1.4 scrub ok 2014-06-02 15:45:01.345821 mon.0 [INF] pgmap v41339: 952 pgs: 952 active+clean; 17130 MB data, 115 GB used, 167 GB / 297 GB avail 2014-06-02 15:45:05.718640 mon.0 [INF] pgmap v41340: 952 pgs: 1 active+clean+scrubbing+deep, 951 active+clean; 17130 MB data, 115 GB used, 167 GB / 297 GB avail 2014-06-02 15:45:53.997726 osd.1 [INF] 1.5 scrub ok 2014-06-02 15:45:06.734270 mon.0 [INF] pgmap v41341: 952 pgs: 1 active+clean+scrubbing+deep, 951 active+clean; 17130 MB data, 115 GB used, 167 GB / 297 GB avail 2014-06-02 15:45:15.722456 mon.0 [INF] pgmap v41342: 952 pgs: 952 active+clean; 17130 MB data, 115 GB used, 167 GB / 297 GB avail 2014-06-02 15:46:06.836430 osd.0 [INF] 17.75 deep-scrub ok 2014-06-02 15:45:55.720929 mon.0 [INF] pgmap v41343: 952 pgs: 1 active+clean+scrubbing+deep, 951 active+clean; 17130 MB data, 115 GB used, 167 GB / 297 GB avail
The output provides:
- Cluster ID
- Cluster health status
- The monitor map epoch and the status of the monitor quorum
- The OSD map epoch and the status of OSDs
- The placement group map version
- The number of placement groups and pools
- The notional amount of data stored and the number of objects stored
- The total amount of data stored
3.2.5. How Ceph calculates data usage
The used
value reflects the actual amount of raw storage used. The xxx GB / xxx GB
value means the amount available, the lesser of the two numbers, of the overall storage capacity of the cluster. The notional number reflects the size of the stored data before it is replicated, cloned or snapshotted. Therefore, the amount of data actually stored typically exceeds the notional amount stored, because Ceph creates replicas of the data and may also use storage capacity for cloning and snapshotting.
3.2.6. Understanding the storage clusters usage stats
To check a cluster’s data usage and data distribution among pools, use the df
option. It is similar to the Linux df
command. You can run either the ceph df
command or ceph df detail
command.
Example
[root@mon ~]# ceph df RAW STORAGE: CLASS SIZE AVAIL USED RAW USED %RAW USED hdd 90 GiB 84 GiB 100 MiB 6.1 GiB 6.78 TOTAL 90 GiB 84 GiB 100 MiB 6.1 GiB 6.78 POOLS: POOL ID STORED OBJECTS USED %USED MAX AVAIL .rgw.root 1 1.3 KiB 4 768 KiB 0 26 GiB default.rgw.control 2 0 B 8 0 B 0 26 GiB default.rgw.meta 3 2.5 KiB 12 2.1 MiB 0 26 GiB default.rgw.log 4 3.5 KiB 208 6.2 MiB 0 26 GiB default.rgw.buckets.index 5 2.4 KiB 33 2.4 KiB 0 26 GiB default.rgw.buckets.data 6 9.6 KiB 15 1.7 MiB 0 26 GiB testpool 10 231 B 5 384 KiB 0 40 GiB
The ceph df detail
command gives more details about other pool statistics such as quota objects, quota bytes, used compression, and under compression.
Example
[root@mon ~]# ceph df detail RAW STORAGE: CLASS SIZE AVAIL USED RAW USED %RAW USED hdd 90 GiB 84 GiB 100 MiB 6.1 GiB 6.78 TOTAL 90 GiB 84 GiB 100 MiB 6.1 GiB 6.78 POOLS: POOL ID STORED OBJECTS USED %USED MAX AVAIL QUOTA OBJECTS QUOTA BYTES DIRTY USED COMPR UNDER COMPR .rgw.root 1 1.3 KiB 4 768 KiB 0 26 GiB N/A N/A 4 0 B 0 B default.rgw.control 2 0 B 8 0 B 0 26 GiB N/A N/A 8 0 B 0 B default.rgw.meta 3 2.5 KiB 12 2.1 MiB 0 26 GiB N/A N/A 12 0 B 0 B default.rgw.log 4 3.5 KiB 208 6.2 MiB 0 26 GiB N/A N/A 208 0 B 0 B default.rgw.buckets.index 5 2.4 KiB 33 2.4 KiB 0 26 GiB N/A N/A 33 0 B 0 B default.rgw.buckets.data 6 9.6 KiB 15 1.7 MiB 0 26 GiB N/A N/A 15 0 B 0 B testpool 10 231 B 5 384 KiB 0 40 GiB N/A N/A 5 0 B 0 B
The RAW STORAGE section of the output provides an overview of the amount of storage the storage cluster uses for data.
- CLASS: The type of devices used.
SIZE: The overall storage capacity managed by the storage cluster.
In the above example, if the
SIZE
is 90 GiB, it is the total size without the replication factor, which is three by default. The total available capacity with the replication factor is 90 GiB/3 = 30 GiB. Based on the full ratio, which is 0.85% by default, the maximum available space is 30 GiB * 0.85 = 25.5 GiBAVAIL: The amount of free space available in the storage cluster.
In the above example, if the
SIZE
is 90 GiB and theUSED
space is 6 GiB, then theAVAIL
space is 84 GiB. The total available space with the replication factor, which is three by default, is 84 GiB/3 = 28 GiBUSED: The amount of used space in the storage cluster consumed by user data, internal overhead, or reserved capacity.
In the above example, 100 MiB is the total space available after considering the replication factor. The actual available size is 33 MiB.
-
RAW USED: The sum of USED space and the space allocated the
db
andwal
BlueStore partitions. -
% RAW USED: The percentage of of RAW USED. Use this number in conjunction with the
full ratio
andnear full ratio
to ensure that you are not reaching the storage cluster’s capacity.
The POOLS section of the output provides a list of pools and the notional usage of each pool. The output from this section DOES NOT reflect replicas, clones or snapshots. For example, if you store an object with 1 MB of data, the notional usage will be 1 MB, but the actual usage may be 3 MB or more depending on the number of replicas for example, size = 3
, clones and snapshots.
- POOL: The name of the pool.
- ID: The pool ID.
- STORED: The actual amount of data stored by the user in the pool.
- OBJECTS: The notional number of objects stored per pool.
-
USED: The notional amount of data stored in kilobytes, unless the number appends M for megabytes or G for gigabytes. It is
STORED
size * replication factor. - %USED: The notional percentage of storage used per pool.
MAX AVAIL: An estimate of the notional amount of data that can be written to this pool. It is the amount of data that can be used before the first OSD becomes full. It considers the projected distribution of data across disks from the CRUSH map and uses the first OSD to fill up as the target.
In the above example,
MAX AVAIL
is 153.85 without considering the replication factor, which is three by default.See the KnowledgeBase article ceph df MAX AVAIL is incorrect for simple replicated pool to calculate the value of
MAX AVAIL
.- QUOTA OBJECTS: The number of quota objects.
- QUOTA BYTES: The number of bytes in the quota objects.
- USED COMPR: The amount of space allocated for compressed data including his includes compressed data, allocation, replication and erasure coding overhead.
- UNDER COMPR: The amount of data passed through compression and beneficial enough to be stored in a compressed form.
The numbers in the POOLS section are notional. They are not inclusive of the number of replicas, snapshots or clones. As a result, the sum of the USED and %USED amounts will not add up to the RAW USED and %RAW USED amounts in the GLOBAL section of the output.
The MAX AVAIL value is a complicated function of the replication or erasure code used, the CRUSH rule that maps storage to devices, the utilization of those devices, and the configured mon_osd_full_ratio
.
Additional Resources
- See How Ceph calculates data usage for details.
- See Understanding the OSD usage stats for details.
3.2.7. Understanding the OSD usage stats
Use the ceph osd df
command to view OSD utilization stats.
[root@mon]# ceph osd df ID CLASS WEIGHT REWEIGHT SIZE USE DATA OMAP META AVAIL %USE VAR PGS 3 hdd 0.90959 1.00000 931GiB 70.1GiB 69.1GiB 0B 1GiB 861GiB 7.53 2.93 66 4 hdd 0.90959 1.00000 931GiB 1.30GiB 308MiB 0B 1GiB 930GiB 0.14 0.05 59 0 hdd 0.90959 1.00000 931GiB 18.1GiB 17.1GiB 0B 1GiB 913GiB 1.94 0.76 57 MIN/MAX VAR: 0.02/2.98 STDDEV: 2.91
- ID: The name of the OSD.
- CLASS: The type of devices the OSD uses.
- WEIGHT: The weight of the OSD in the CRUSH map.
- REWEIGHT: The default reweight value.
- SIZE: The overall storage capacity of the OSD.
- USE: The OSD capacity.
- DATA: The amount of OSD capacity that is used by user data.
-
OMAP: An estimate value of the
bluefs
storage that is being used to store object map (omap
) data (key value pairs stored inrocksdb
). -
META: The
bluefs
space allocated, or the value set in thebluestore_bluefs_min
parameter, whichever is larger, for internal metadata which is calculated as the total space allocated inbluefs
minus the estimatedomap
data size. - AVAIL: The amount of free space available on the OSD.
- %USE: The notional percentage of storage used by the OSD
- VAR: The variation above or below average utilization.
- PGS: The number of placement groups in the OSD.
- MIN/MAX VAR: The minimum and maximum variation across all OSDs.
Additional Resources
- See How Ceph calculates data usage for details.
- See Understanding the OSD usage stats for details.
- See CRUSH Weights in Red Hat Ceph Storage Storage Strategies Guide for details.
3.2.8. Checking the Red Hat Ceph Storage cluster status
You can check the status of the Red Hat Ceph Storage cluster from the command-line interface. The status
sub command or the -s
argument will display the current status of the storage cluster.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To check a storage cluster’s status, execute the following:
[root@mon ~]# ceph status
Or:
[root@mon ~]# ceph -s
In interactive mode, type
status
and press Enter:[root@mon ~]# ceph> status
For example, a tiny Ceph cluster consisting of one monitor, and two OSDs can print the following:
cluster b370a29d-9287-4ca3-ab57-3d824f65e339 health HEALTH_OK monmap e1: 1 mons at {ceph1=10.0.0.8:6789/0}, election epoch 2, quorum 0 ceph1 osdmap e63: 2 osds: 2 up, 2 in pgmap v41332: 952 pgs, 20 pools, 17130 MB data, 2199 objects 115 GB used, 167 GB / 297 GB avail 1 active+clean+scrubbing+deep 951 active+clean
3.2.9. Checking the Ceph Monitor status
If the storage cluster has multiple Ceph Monitors, which is a requirement for a production Red Hat Ceph Storage cluster, then check the Ceph Monitor quorum status after starting the storage cluster, and before doing any reading or writing of data.
A quorum must be present when multiple monitors are running.
Check Ceph Monitor status periodically to ensure that they are running. If there is a problem with the Ceph Monitor, that prevents an agreement on the state of the storage cluster, the fault may prevent Ceph clients from reading and writing data.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To display the monitor map, execute the following:
[root@mon ~]# ceph mon stat
or
[root@mon ~]# ceph mon dump
To check the quorum status for the storage cluster, execute the following:
[root@mon ~]# ceph quorum_status -f json-pretty
Ceph will return the quorum status. A Red Hat Ceph Storage cluster consisting of three monitors may return the following:
Example
{ "election_epoch": 10, "quorum": [ 0, 1, 2], "monmap": { "epoch": 1, "fsid": "444b489c-4f16-4b75-83f0-cb8097468898", "modified": "2011-12-12 13:28:27.505520", "created": "2011-12-12 13:28:27.505520", "mons": [ { "rank": 0, "name": "a", "addr": "127.0.0.1:6789\/0"}, { "rank": 1, "name": "b", "addr": "127.0.0.1:6790\/0"}, { "rank": 2, "name": "c", "addr": "127.0.0.1:6791\/0"} ] } }
3.2.10. Using the Ceph administration socket
Use the administration socket to interact with a given daemon directly by using a UNIX socket file. For example, the socket enables you to:
- List the Ceph configuration at runtime
-
Set configuration values at runtime directly without relying on Monitors. This is useful when Monitors are
down
. - Dump historic operations
- Dump the operation priority queue state
- Dump operations without rebooting
- Dump performance counters
In addition, using the socket is helpful when troubleshooting problems related to Monitors or OSDs.
The administration socket is only available while a daemon is running. When you shut down the daemon properly, the administration socket is removed. However, if the daemon terminates unexpectedly, the administration socket might persist.
Regardless, if the daemon is not running, a following error is returned when attempting to use the administration socket:
Error 111: Connection Refused
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To use the socket:
Syntax
[root@mon ~]# ceph daemon TYPE.ID COMMAND
Replace:
-
TYPE
with the type of the Ceph daemon (mon
,osd
,mds
). -
ID
with the daemon ID COMMAND
with the command to run. Usehelp
to list the available commands for a given daemon.Example
To view a Monitor status of a Ceph Monitor named
mon.0
:[root@mon ~]# ceph daemon mon.0 mon_status
-
Alternatively, specify the Ceph daemon by using its socket file:
ceph daemon /var/run/ceph/SOCKET_FILE COMMAND
To view the status of an Ceph OSD named
osd.2
:[root@mon ~]# ceph daemon /var/run/ceph/ceph-osd.2.asok status
To list all socket files for the Ceph processes:
[root@mon ~]# ls /var/run/ceph
Additional Resources
- See the Red Hat Ceph Storage Troubleshooting Guide for more information.
3.2.11. Understanding the Ceph OSD status
An OSD’s status is either in the cluster, in
, or out of the cluster, out
. It is either up and running, up
, or it is down and not running, or down
. If an OSD is up
, it may be either in
the storage cluster, where data can be read and written, or it is out
of the storage cluster. If it was in
the cluster and recently moved out
of the cluster, Ceph will migrate placement groups to other OSDs. If an OSD is out
of the cluster, CRUSH will not assign placement groups to the OSD. If an OSD is down
, it should also be out
.
If an OSD is down
and in
, there is a problem and the cluster will not be in a healthy state.
If you execute a command such as ceph health
, ceph -s
or ceph -w
, you may notice that the cluster does not always echo back HEALTH OK
. Don’t panic. With respect to OSDs, you should expect that the cluster will NOT echo HEALTH OK
in a few expected circumstances:
- You haven’t started the cluster yet, it won’t respond.
- You have just started or restarted the cluster and it’s not ready yet, because the placement groups are getting created and the OSDs are in the process of peering.
- You just added or removed an OSD.
- You just have modified the cluster map.
An important aspect of monitoring OSDs is to ensure that when the cluster is up and running that all OSDs that are in
the cluster are up
and running, too.
To see if all OSDs are running, execute:
[root@mon ~]# ceph osd stat
or
[root@mon ~]# ceph osd dump
The result should tell you the map epoch, eNNNN
, the total number of OSDs, x
, how many, y
, are up
, and how many, z
, are in
:
eNNNN: x osds: y up, z in
If the number of OSDs that are in
the cluster is more than the number of OSDs that are up
. Execute the following command to identify the ceph-osd
daemons that aren’t running:
[root@mon ~]# ceph osd tree
Example
# id weight type name up/down reweight -1 3 pool default -3 3 rack mainrack -2 3 host osd-host 0 1 osd.0 up 1 1 1 osd.1 up 1 2 1 osd.2 up 1
The ability to search through a well-designed CRUSH hierarchy may help you troubleshoot the storage cluster by identifying the physical locations faster.
If an OSD is down
, connect to the node and start it. You can use Red Hat Storage Console to restart the OSD node, or you can use the command line.
Example
[root@mon ~]# systemctl start ceph-osd@OSD_ID
3.2.12. Additional Resources
3.3. Low-level monitoring of a Ceph storage cluster
As a storage administrator, you can monitor the health of a Red Hat Ceph Storage cluster from a low-level perspective. Low-level monitoring typically involves ensuring that Ceph OSDs are peering properly. When peering faults occur, placement groups operate in a degraded state. This degraded state can be the result of many different things, such as hardware failure, a hung or crashed Ceph daemon, network latency, or a complete site outage.
3.3.1. Prerequisites
- A running Red Hat Ceph Storage cluster.
3.3.2. Monitoring Placement Group Sets
When CRUSH assigns placement groups to OSDs, it looks at the number of replicas for the pool and assigns the placement group to OSDs such that each replica of the placement group gets assigned to a different OSD. For example, if the pool requires three replicas of a placement group, CRUSH may assign them to osd.1
, osd.2
and osd.3
respectively. CRUSH actually seeks a pseudo-random placement that will take into account failure domains you set in the CRUSH map, so you will rarely see placement groups assigned to nearest neighbor OSDs in a large cluster. We refer to the set of OSDs that should contain the replicas of a particular placement group as the Acting Set. In some cases, an OSD in the Acting Set is down
or otherwise not able to service requests for objects in the placement group. When these situations arise, don’t panic. Common examples include:
- You added or removed an OSD. Then, CRUSH reassigned the placement group to other OSDs—thereby changing the composition of the Acting Set and spawning the migration of data with a "backfill" process.
-
An OSD was
down
, was restarted and is nowrecovering
. -
An OSD in the Acting Set is
down
or unable to service requests, and another OSD has temporarily assumed its duties.
Ceph processes a client request using the Up Set, which is the set of OSDs that will actually handle the requests. In most cases, the Up Set and the Acting Set are virtually identical. When they are not, it may indicate that Ceph is migrating data, an OSD is recovering, or that there is a problem, that is, Ceph usually echoes a HEALTH WARN
state with a "stuck stale" message in such scenarios.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To retrieve a list of placement groups:
[root@mon ~]# ceph pg dump
To view which OSDs are in the Acting Set or in the Up Set for a given placement group:
[root@mon ~]# ceph pg map PG_NUM
The result should tell you the osdmap epoch,
eNNN
, the placement group number,PG_NUM
, the OSDs in the Up Setup[]
, and the OSDs in the acting set,acting[]
:[root@mon ~]# ceph osdmap eNNN pg PG_NUM-> up [0,1,2] acting [0,1,2]
NoteIf the Up Set and Acting Set do not match, this may be an indicator that the cluster rebalancing itself or of a potential problem with the cluster.
3.3.3. Ceph OSD peering
Before you can write data to a placement group, it must be in an active
state, and it should be in a clean
state. For Ceph to determine the current state of a placement group, the primary OSD of the placement group that is, the first OSD in the acting set, peers with the secondary and tertiary OSDs to establish agreement on the current state of the placement group. Assuming a pool with 3 replicas of the PG.
3.3.4. Placement Group States
If you execute a command such as ceph health
, ceph -s
or ceph -w
, you may notice that the cluster does not always echo back HEALTH OK
. After you check to see if the OSDs are running, you should also check placement group states. You should expect that the cluster will NOT echo HEALTH OK
in a number of placement group peering-related circumstances:
- You have just created a pool and placement groups haven’t peered yet.
- The placement groups are recovering.
- You have just added an OSD to or removed an OSD from the cluster.
- You have just modified the CRUSH map and the placement groups are migrating.
- There is inconsistent data in different replicas of a placement group.
- Ceph is scrubbing a placement group’s replicas.
- Ceph doesn’t have enough storage capacity to complete backfilling operations.
If one of the foregoing circumstances causes Ceph to echo HEALTH WARN
, don’t panic. In many cases, the cluster will recover on its own. In some cases, you may need to take action. An important aspect of monitoring placement groups is to ensure that when the cluster is up and running that all placement groups are active
, and preferably in the clean
state.
To see the status of all placement groups, execute:
[root@mon ~]# ceph pg stat
The result should tell you the placement group map version, vNNNNNN
, the total number of placement groups, x
, and how many placement groups, y
, are in a particular state such as active+clean
:
vNNNNNN: x pgs: y active+clean; z bytes data, aa MB used, bb GB / cc GB avail
It is common for Ceph to report multiple states for placement groups.
Snapshot Trimming PG States
When snapshots exist, two additional PG states will be reported.
-
snaptrim
: The PGs are currently being trimmed -
snaptrim_wait
: The PGs are waiting to be trimmed
Example Output:
244 active+clean+snaptrim_wait 32 active+clean+snaptrim
In addition to the placement group states, Ceph will also echo back the amount of data used, aa
, the amount of storage capacity remaining, bb
, and the total storage capacity for the placement group. These numbers can be important in a few cases:
-
You are reaching the
near full ratio
orfull ratio
. - Your data isn’t getting distributed across the cluster due to an error in the CRUSH configuration.
Placement Group IDs
Placement group IDs consist of the pool number, and not the pool name, followed by a period (.) and the placement group ID—a hexadecimal number. You can view pool numbers and their names from the output of ceph osd lspools
. The default pool names data
, metadata
and rbd
correspond to pool numbers 0
, 1
and 2
respectively. A fully qualified placement group ID has the following form:
POOL_NUM.PG_ID
Example output:
0.1f
To retrieve a list of placement groups:
[root@mon ~]# ceph pg dump
To format the output in JSON format and save it to a file:
[root@mon ~]# ceph pg dump -o FILE_NAME --format=json
To query a particular placement group:
[root@mon ~]# ceph pg POOL_NUM.PG_ID query
Example output in JSON format:
{ "state": "active+clean", "up": [ 1, 0 ], "acting": [ 1, 0 ], "info": { "pgid": "1.e", "last_update": "4'1", "last_complete": "4'1", "log_tail": "0'0", "last_backfill": "MAX", "purged_snaps": "[]", "history": { "epoch_created": 1, "last_epoch_started": 537, "last_epoch_clean": 537, "last_epoch_split": 534, "same_up_since": 536, "same_interval_since": 536, "same_primary_since": 536, "last_scrub": "4'1", "last_scrub_stamp": "2013-01-25 10:12:23.828174" }, "stats": { "version": "4'1", "reported": "536'782", "state": "active+clean", "last_fresh": "2013-01-25 10:12:23.828271", "last_change": "2013-01-25 10:12:23.828271", "last_active": "2013-01-25 10:12:23.828271", "last_clean": "2013-01-25 10:12:23.828271", "last_unstale": "2013-01-25 10:12:23.828271", "mapping_epoch": 535, "log_start": "0'0", "ondisk_log_start": "0'0", "created": 1, "last_epoch_clean": 1, "parent": "0.0", "parent_split_bits": 0, "last_scrub": "4'1", "last_scrub_stamp": "2013-01-25 10:12:23.828174", "log_size": 128, "ondisk_log_size": 128, "stat_sum": { "num_bytes": 205, "num_objects": 1, "num_object_clones": 0, "num_object_copies": 0, "num_objects_missing_on_primary": 0, "num_objects_degraded": 0, "num_objects_unfound": 0, "num_read": 1, "num_read_kb": 0, "num_write": 3, "num_write_kb": 1 }, "stat_cat_sum": { }, "up": [ 1, 0 ], "acting": [ 1, 0 ] }, "empty": 0, "dne": 0, "incomplete": 0 }, "recovery_state": [ { "name": "Started\/Primary\/Active", "enter_time": "2013-01-23 09:35:37.594691", "might_have_unfound": [ ], "scrub": { "scrub_epoch_start": "536", "scrub_active": 0, "scrub_block_writes": 0, "finalizing_scrub": 0, "scrub_waiting_on": 0, "scrub_waiting_on_whom": [ ] } }, { "name": "Started", "enter_time": "2013-01-23 09:35:31.581160" } ] }
Additional Resources
- See the chapter Object Storage Daemon (OSD) configuration options in the Red Hat Ceph Storage 4 Configuration Guide for more details on the snapshot trimming settings.
3.3.5. Placement Group creating state
When you create a pool, it will create the number of placement groups you specified. Ceph will echo creating
when it is creating one or more placement groups. Once they are created, the OSDs that are part of a placement group’s Acting Set will peer. Once peering is complete, the placement group status should be active+clean
, which means a Ceph client can begin writing to the placement group.
3.3.6. Placement group peering state
When Ceph is Peering a placement group, Ceph is bringing the OSDs that store the replicas of the placement group into agreement about the state of the objects and metadata in the placement group. When Ceph completes peering, this means that the OSDs that store the placement group agree about the current state of the placement group. However, completion of the peering process does NOT mean that each replica has the latest contents.
Authoritative History
Ceph will NOT acknowledge a write operation to a client, until all OSDs of the acting set persist the write operation. This practice ensures that at least one member of the acting set will have a record of every acknowledged write operation since the last successful peering operation.
With an accurate record of each acknowledged write operation, Ceph can construct and disseminate a new authoritative history of the placement group. A complete, and fully ordered set of operations that, if performed, would bring an OSD’s copy of a placement group up to date.
3.3.7. Placement group active state
Once Ceph completes the peering process, a placement group may become active
. The active
state means that the data in the placement group is generally available in the primary placement group and the replicas for read and write operations.
3.3.8. Placement Group clean state
When a placement group is in the clean
state, the primary OSD and the replica OSDs have successfully peered and there are no stray replicas for the placement group. Ceph replicated all objects in the placement group the correct number of times.
3.3.9. Placement Group degraded state
When a client writes an object to the primary OSD, the primary OSD is responsible for writing the replicas to the replica OSDs. After the primary OSD writes the object to storage, the placement group will remain in a degraded
state until the primary OSD has received an acknowledgement from the replica OSDs that Ceph created the replica objects successfully.
The reason a placement group can be active+degraded
is that an OSD may be active
even though it doesn’t hold all of the objects yet. If an OSD goes down
, Ceph marks each placement group assigned to the OSD as degraded
. The OSDs must peer again when the OSD comes back online. However, a client can still write a new object to a degraded
placement group if it is active
.
If an OSD is down
and the degraded
condition persists, Ceph may mark the down
OSD as out
of the cluster and remap the data from the down
OSD to another OSD. The time between being marked down
and being marked out
is controlled by mon_osd_down_out_interval
, which is set to 600
seconds by default.
A placement group can also be degraded
, because Ceph cannot find one or more objects that Ceph thinks should be in the placement group. While you cannot read or write to unfound objects, you can still access all of the other objects in the degraded
placement group.
Let’s say there are 9 OSDs in a three way replica pool. If OSD number 9 goes down, the PGs assigned to OSD 9 go in a degraded state. If OSD 9 doesn’t recover, it goes out of the cluster and the cluster rebalances. In that scenario, the PGs are degraded and then recover to an active state.
3.3.10. Placement Group recovering state
Ceph was designed for fault-tolerance at a scale where hardware and software problems are ongoing. When an OSD goes down
, its contents may fall behind the current state of other replicas in the placement groups. When the OSD is back up
, the contents of the placement groups must be updated to reflect the current state. During that time period, the OSD may reflect a recovering
state.
Recovery isn’t always trivial, because a hardware failure might cause a cascading failure of multiple OSDs. For example, a network switch for a rack or cabinet may fail, which can cause the OSDs of a number of host machines to fall behind the current state of the cluster. Each one of the OSDs must recover once the fault is resolved.
Ceph provides a number of settings to balance the resource contention between new service requests and the need to recover data objects and restore the placement groups to the current state. The osd recovery delay start
setting allows an OSD to restart, re-peer and even process some replay requests before starting the recovery process. The osd recovery threads
setting limits the number of threads for the recovery process, by default one thread. The osd recovery thread timeout
sets a thread timeout, because multiple OSDs may fail, restart and re-peer at staggered rates. The osd recovery max active
setting limits the number of recovery requests an OSD will entertain simultaneously to prevent the OSD from failing to serve . The osd recovery max chunk
setting limits the size of the recovered data chunks to prevent network congestion.
3.3.11. Back fill state
When a new OSD joins the cluster, CRUSH will reassign placement groups from OSDs in the cluster to the newly added OSD. Forcing the new OSD to accept the reassigned placement groups immediately can put excessive load on the new OSD. Backfilling the OSD with the placement groups allows this process to begin in the background. Once backfilling is complete, the new OSD will begin serving requests when it is ready.
During the backfill operations, you may see one of several states: * backfill_wait
indicates that a backfill operation is pending, but isn’t underway yet * backfill
indicates that a backfill operation is underway * backfill_too_full
indicates that a backfill operation was requested, but couldn’t be completed due to insufficient storage capacity.
When a placement group cannot be backfilled, it may be considered incomplete
.
Ceph provides a number of settings to manage the load spike associated with reassigning placement groups to an OSD, especially a new OSD. By default, osd_max_backfills
sets the maximum number of concurrent backfills to or from an OSD to 10. The osd backfill full ratio
enables an OSD to refuse a backfill request if the OSD is approaching its full ratio, by default 85%. If an OSD refuses a backfill request, the osd backfill retry interval
enables an OSD to retry the request, by default after 10 seconds. OSDs can also set osd backfill scan min
and osd backfill scan max
to manage scan intervals, by default 64 and 512.
For some workloads, it is beneficial to avoid regular recovery entirely and use backfill instead. Since backfilling occurs in the background, this allows I/O to proceed on the objects in the OSD. To force backfill rather than recovery, set osd_min_pg_log_entries
to 1
, and set osd_max_pg_log_entries
to 2
. Contact your Red Hat Support account team for details on when this situation is appropriate for your workload.
3.3.12. Changing the priority of recovery or backfill operations
You might encounter a situation where some placement groups (PGs) require recovery and/or backfill, and some of those placement groups contain more important data than do others. Use the pg force-recovery
or pg force-backfill
command to ensure that the PGs with the higher-priority data undergo recovery or backfill first.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
Issue the
pg force-recovery
orpg force-backfill
command and specify the order of priority for the PGs with the higher-priority data:Syntax
ceph pg force-recovery PG1 [PG2] [PG3 ...] ceph pg force-backfill PG1 [PG2] [PG3 ...]
Example
[root@node]# ceph pg force-recovery group1 group2 [root@node]# ceph pg force-backfill group1 group2
This command causes Red Hat Ceph Storage to perform recovery or backfill on specified placement groups (PGs) first, before processing other placement groups. Issuing the command does not interrupt backfill or recovery operations that are currently executing. After the currently running operations have finished, recovery or backfill takes place as soon as possible for the specified PGs.
3.3.13. Changing or canceling a recovery or backfill operation on specified placement groups
If you cancel a high-priority force-recovery
or force-backfill
operation on certain placement groups (PGs) in a storage cluster, operations for those PGs revert to the default recovery or backfill settings.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To change or cancel a recovery or backfill operation on specified placement groups:
Syntax
ceph pg cancel-force-recovery PG1 [PG2] [PG3 ...] ceph pg cancel-force-backfill PG1 [PG2] [PG3 ...]
Example
[root@node]# ceph pg cancel-force-recovery group1 group2 [root@node]# ceph pg cancel-force-backfill group1 group2
This cancels the
force
flag and processes the PGs in the default order.After recovery or backfill operations for the specified PGs have completed, processing order reverts to the default.
Additional Resources
- For more information about the order of priority of recovery and backfill operations in RADOS, see Priority of placement group recovery and backfill in RADOS.
3.3.14. Forcing high-priority recovery or backfill operations for pools
If all of the placement groups in a pool require high-priority recovery or backfill, use the force-recovery
or force-backfill
options to initiate the operation.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To force the high-priority recovery or backfill on all placement groups in a specified pool:
Syntax
ceph osd pool force-recovery POOL_NAME ceph osd pool force-backfill POOL_NAME
Example
[root@node]# ceph osd pool force-recovery pool1 [root@node]# ceph osd pool force-backfill pool1
NoteUse the
force-recovery
andforce-backfill
commands with caution. Changing the priority of these operations might break the ordering of Ceph’s internal priority computations.
3.3.15. Canceling high-priority recovery or backfill operations for pools
If you cancel a high-priority force-recovery
or force-backfill
operation on all placement groups in a pool, operations for the PGs in that pool revert to the default recovery or backfill settings.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To cancel a high-priority recovery or backfill operation on all placement groups in a specified pool:
Syntax
ceph osd pool cancel-force-recovery POOL_NAME ceph osd pool cancel-force-backfill POOL_NAME
Example
[root@node]# ceph osd pool cancel-force-recovery pool1 [root@node]# ceph osd pool cancel-force-backfill pool1
3.3.16. Rearranging the priority of recovery or backfill operations for pools
If you have multiple pools that currently use the same underlying OSDs and some of the pools contain high-priority data, you can rearrange the order in which the operations execute. Use the recovery_priority
option to assign a higher priority value to the pools with the higher-priority data. Those pools will execute before pools with lower priority values, or pools that are set to default priority.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To rearrange the recovery/backfill priority for the pools:
Syntax
ceph osd pool set POOL_NAME recovery_priority VALUE
Example
ceph osd pool set pool1 recovery_priority 10
VALUE sets the order of priority. For example, if you have 10 pools, the pool with a priority value of 10 gets processed first, followed by the pool with priority 9, and so on. If only some pools have high priority, you can set priority values for just those pools. The pools without set priority values are processed in the default order.
3.3.17. Priority of placement group recovery in RADOS
This section describes the relative priority values for the recovery and backfilling of placement groups (PGs) in RADOS. Higher values are processed first. Inactive PGs receive higher priority values than active or degraded PGs.
Operation | Value | Description |
---|---|---|
OSD_RECOVERY_PRIORITY_MIN | 0 | Minimum recovery value |
OSD_BACKFILL_PRIORITY_BASE | 100 | Base backfill priority for MBackfillReserve |
OSD_BACKFILL_DEGRADED_PRIORITY_BASE | 140 | Base backfill priority for MBackfillReserve (degraded PG) |
OSD_RECOVERY_PRIORITY_BASE | 180 | Base recovery priority for MBackfillReserve |
OSD_BACKFILL_INACTIVE_PRIORITY_BASE | 220 | Base backfill priority for MBackfillReserve (inactive PG) |
OSD_RECOVERY_INACTIVE_PRIORITY_BASE | 220 | Base recovery priority for MRecoveryReserve (inactive PG) |
OSD_RECOVERY_PRIORITY_MAX | 253 | Max manually/automatically set recovery priority for MBackfillReserve |
OSD_BACKFILL_PRIORITY_FORCED | 254 | Backfill priority for MBackfillReserve, when forced manually |
OSD_RECOVERY_PRIORITY_FORCED | 255 | Recovery priority for MRecoveryReserve, when forced manually |
OSD_DELETE_PRIORITY_NORMAL | 179 | Priority for PG deletion when the OSD is not fullish |
OSD_DELETE_PRIORITY_FULLISH | 219 | Priority for PG deletion when the OSD is approaching full |
OSD_DELETE_PRIORITY_FULL | 255 | Priority for deletion when the OSD is full |
3.3.18. Placement Group remapped state
When the Acting Set that services a placement group changes, the data migrates from the old acting set to the new acting set. It may take some time for a new primary OSD to service requests. So it may ask the old primary to continue to service requests until the placement group migration is complete. Once data migration completes, the mapping uses the primary OSD of the new acting set.
3.3.19. Placement Group stale state
While Ceph uses heartbeats to ensure that hosts and daemons are running, the ceph-osd
daemons may also get into a stuck
state where they aren’t reporting statistics in a timely manner. For example, a temporary network fault. By default, OSD daemons report their placement group, up thru, boot and failure statistics every half second, that is, 0.5
, which is more frequent than the heartbeat thresholds. If the Primary OSD of a placement group’s acting set fails to report to the monitor or if other OSDs have reported the primary OSD down
, the monitors will mark the placement group stale
.
When you start the storage cluster, it is common to see the stale
state until the peering process completes. After the storage cluster has been running for awhile, seeing placement groups in the stale
state indicates that the primary OSD for those placement groups is down
or not reporting placement group statistics to the monitor.
3.3.20. Placement Group misplaced state
There are some temporary backfilling scenarios where a PG gets mapped temporarily to an OSD. When that temporary
situation should no longer be the case, the PGs might still reside in the temporary location and not in the proper location. In which case, they are said to be misplaced
. That’s because the correct number of extra copies actually exist, but one or more copies is in the wrong place.
For example, there are 3 OSDs: 0,1,2 and all PGs map to some permutation of those three. If you add another OSD (OSD 3), some PGs will now map to OSD 3 instead of one of the others. However, until OSD 3 is backfilled, the PG will have a temporary mapping allowing it to continue to serve I/O from the old mapping. During that time, the PG is misplaced
, because it has a temporary mapping, but not degraded
, since there are 3 copies.
Example
pg 1.5: up=acting: [0,1,2]
ADD_OSD_3
pg 1.5: up: [0,3,1] acting: [0,1,2]
[0,1,2] is a temporary mapping, so the up
set is not equal to the acting
set and the PG is misplaced
but not degraded
since [0,1,2] is still three copies.
Example
pg 1.5: up=acting: [0,3,1]
OSD 3 is now backfilled and the temporary mapping is removed, not degraded and not misplaced.
3.3.21. Placement Group incomplete state
A PG goes into a incomplete
state when there is incomplete content and peering fails, that is, when there are no complete OSDs which are current enough to perform recovery.
Lets say OSD 1, 2, and 3 are the acting OSD set and it switches to OSD 1, 4, and 3, then osd.1
will request a temporary acting set of OSD 1, 2, and 3 while backfilling 4. During this time, if OSD 1, 2, and 3 all go down, osd.4
will be the only one left which might not have fully backfilled all the data. At this time, the PG will go incomplete
indicating that there are no complete OSDs which are current enough to perform recovery.
Alternately, if osd.4
is not involved and the acting set is simply OSD 1, 2, and 3 when OSD 1, 2, and 3 go down, the PG would likely go stale
indicating that the mons have not heard anything on that PG since the acting set changed. The reason being there are no OSDs left to notify the new OSDs.
3.3.22. Identifying stuck Placement Groups
As previously noted, a placement group isn’t necessarily problematic just because its state isn’t active+clean
. Generally, Ceph’s ability to self repair may not be working when placement groups get stuck. The stuck states include:
- Unclean: Placement groups contain objects that are not replicated the desired number of times. They should be recovering.
-
Inactive: Placement groups cannot process reads or writes because they are waiting for an OSD with the most up-to-date data to come back
up
. -
Stale: Placement groups are in an unknown state, because the OSDs that host them have not reported to the monitor cluster in a while, and can be configured with the
mon osd report timeout
setting.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To identify stuck placement groups, execute the following:
ceph pg dump_stuck {inactive|unclean|stale|undersized|degraded [inactive|unclean|stale|undersized|degraded...]} {<int>}
3.3.23. Finding an object’s location
The Ceph client retrieves the latest cluster map and the CRUSH algorithm calculates how to map the object to a placement group, and then calculates how to assign the placement group to an OSD dynamically.
Prerequisites
- A running Red Hat Ceph Storage cluster.
- Root-level access to the node.
Procedure
To find the object location, all you need is the object name and the pool name:
ceph osd map POOL_NAME OBJECT_NAME