Ceph Cheat Sheet

Show the topology of the ceph cluster

  • list osd daemon and classes of osds + physical layout which asked from crush map
ceph osd tree
ceph osd tree -f json / -f json-pretty

Getting low level info of ceph cluster

  • epoch: the number of state changes
ceph osd dump

List all osd IDs

ceph osd ls

Find specific osd daemon based on its ID

ceph osd find <osd.id>
ceph osd crush dump

List pools with its ID

ceph osd lspools
rados lspools

Operation on MONs and get information from MONs

mon map
crush map
mds map
#cluster health / osd and PGs info / authentication and capabilities
pg map

Check monitors status

ceph mon stat
ceph mon dump
#mds status
ceph mds stat

If we named or cluster other than default “ceph” we have to enter the cluster name in each commnads with “–cluster-name” switch to avoid this we can set and environment variable as follow:

export CEPH_ARGS="--cluser <my_cluser_name>"

Ceph configuration inspection

there is ceph.conf or mu_cluster_name.conf in the /etc/ceph/ directory which is the configuration of the ceph cluster. Some elements in the config file is mandatory like:

[global]
fsid
authentication
cluster network
mon host
mon initial members
public network

*It’s better to use “under score” in variable name instead of “space”

Admin Socket

We have an admin socket for each daemon and we can ask question or query them directly but we must be in the desired host that the daemon exist
Location of socket: /var/run/ceph

ceph daemon mon.mon1 help
#talk to the daemon directly mon.mon1=mon.<host_name>
ceph daemon mon.mon1 configshow
ceph daemon osd.<osd_nubmer> help
#remember to call the command in the desired host that daemon is living

To query the daemon from other hosts we can use bellow command which is talk to all daemons in the cluster

ceph tell 
#ceph tell <osd.* version>

Configuration Injection

We can change the cluster configuration after the cluster have been initialized but in some cases the configuration derivative must be exist in the config file to take changes effect on the cluster if they are not exist we have to restart cluster services to take change effect

Scrub

It is task for checking consistency of data through the cluster. It has 2 types:
list scrub: is checking metada
deep scrub: is calculating hash of PGs and compare them through other copies of the PG across the cluster

Leave a Reply

Your email address will not be published. Required fields are marked *