ceph -w
- show running cluster ops (recovery etc)
ceph versions
- show versions of daemons in clusterceph features
- show enabled feature level (i.e do not allow lower level to connect)
Note that create options cant modify existing permissions, you have to use auth caps
for it
ceph auth get-or-create client.nagios mon 'allow r'
- create nagios user with rights to monitor and return his keyceph auth get-or-create client.hypervisor mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes'
- create user with enough rights for libvirt to use storage on 'volumes'ceph-authtool -C -n client.hypervisor --gen-key keyring
- name is of type.user format so clients areclient.name
, osds areosd.0
etcceph auth list
- list authceph auth caps client.hypervisor osd 'allow rw pool=volumes'
- modify permissions for user.''
for none. You have to specify all (mon+osd, or mon+osd+mds), if you dont it will zero out other permissions. So if you change osd perms, copy-paste mon permissions tooceph auth import -i /etc/ceph/client.nagios.keyring
- import a keyring
ceph osd pool create volumes 512
- create poolvolumes
with512
placement groupsceph osd pool set {pool-name} pg_num {pg_num}
- change placement group count (disruptive). Remember to also change pgp_num after that, obsolete, see autoscalerceph osd pool set {pool-name} pgp_num {pgp_num}
- change placement group for placement count (disruptive). Remember to change pg_num before thatceph pg ls-by-pool {pool-name}
ceph osd pool autoscale-status
will give you state of it. The important part here is "BIAS", that's preferred method of controlling number of PGs per poolceph osd pool set default.rgw.buckets.index pg_autoscale_bias 16
- multiply ratio by that number. Which means for big ratios (like.index
vs.data
) you might need to use big number to affect placementceph osd pool set default.rgw.buckets.index pg_num_min 64
- to set minimum - currently you need to resize to that minimum first (see manual method) then apply it
ceph osd pool set foo pg_autoscale_mode off
ceph osd pool set foo pg_num 64
- createceph osd pool set foo pgp_num 64
- balance (pgp means "placement groups for placement")
ceph daemon mon.$(hostname -s) sessions |less
- show active sessions on current monceph features
- show how many clients use given feature set and client version
rbd create mypool/myimage --size 102400
- create 100GB image. THIS IS IN MEGABYTES and it doesnt support usual k/M/G/T suffixesrbd info bd info volumes/volume
- get info about image.volumes/
is name of the pool, not required if using defaultrados listwatchers -p volumes rbd_header.27b99c4dd4a60
- get info what is using the image. the ID comes fromrbd_info
block_name_prefix field, just replacerbd_data
withrbd_header
ceph-osd -i 11 --mkjournal
- initialize journalceph-osd -i 11 --flush-journal
- flush journal (stop osd service first!)ceph-osd -i 11 --mkfs --mkkey
- create fs and key for osdceph auth add osd.8 osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-8/keyring
- add key for osdceph osd create 2e6ee69a-5477-40b2-9eea-c675ef8ca2a3
- create osd from blkuidceph-volume lvm list
- show lvm to osd mapping
ceph osd crush reweight osd.{osd-num} 0 # wait for rebalance
ceph osd out {osd-num}
ceph osd crush remove osd.{osd-num}
ceph auth del osd.{osd-num}
ceph osd rm {osd-num}
umount /var/lib/ceph/osd/*
for a in `lvs | grep osd-block |grep ceph |awk '{print $2}'` ; do vgremove $a ; done
ceph osd set noout
ceph osd set norebalance
restart
ceph osd unset noout
ceph osd unset norebalance
ceph osd set noin
- do not add new ones automaticallyceph osd set nobackfill
- do not start backfillceph osd set norecover
- do not start recovery
First, destroy old:
ceph osd destroy 4
then prepare new
ceph-volume lvm create --osd-id 4 --data /dev/nvme0n1p5
or in parts
ceph-volume lvm prepare --osd-id 4 --data /dev/nvme0n1p5
ceph-volume lvm activate 4 fsid-from-above-command
- deep scrub:
ceph pg deep-scrub <pg.id>
to get detailceph health detail
radosgw-admin user create --uid="username" --display-name="long username"
radosgw-admin user rm --uid=username
radosgw-admin bucket list
radosgw-admin metadata get user:testuser
radosgw-admin bi list --bucket=bucketname
- list bucket index
for a in .rgw.root .rgw.control .rgw.gc .rgw.buckets .rgw.buckets.index .rgw.buckets.extra .log .intent-log .usage .users .users.email .users.swift .users.uid ; do ceph osd pool create $a 16 16 ; done
will create small (16 PG) pools for RADOS; you can tune up but not down (AFAIK, might be fixed) so it is better to start small
rbd resize --image pool-name/volume-name --size 115G
- resize in KVM viavirsh blockresize vmname device --size 115G
, device can be justvdX
rbd --pool volumes ls
rbd snap ls volumes/<image_name>
- get snapshot namerbd snap protect volumes/<image_name>@<snapshot_name>
- protect it (from removal)rbd clone volumes/<image_name>@<snapshot_name> volumes/<image_name>.snap
- clone itvolumes/<image_name>.snap
is now available for userbd device map volumes/<image_name>.snap --id admin
- map itrbd children volumes/<image_name>@<snapshot_name>
- list snapshot childrenrbd flatten volumes/<image_name>.snap
- flatten (takes a long time, it's full copy)
ceph osd crush tunables optimal
- run on new cluster to use optimal profile instead of legacy; will cause rebalance
add types = [ "rbd", 1024 ]
to lvm.conf in device section to make LVM see it
/sys/kernel/debug/ceph/<cluster-fsid.client-id>/osdc
contains in-flight requests
ceph crash ls
- to see listceph crash info <id>
- to see detailsceph crash archive-all
- cleanup
ceph osd set-full-ratio 0.95
ceph osd test-reweight-by-utilization
ceph osd reweight-by-utilization
ceph osd reweight osd.1 0.8
ceph mgr module enable balancer
ceph balancer on
ceph balancer mode upmap
ceph balancer eval
ceph balancer eval-verbose
ceph balancer optimize new-plan
ceph balancer show new-plan
ceph balancer ls
ceph balancer status
ceph balancer rm new-plan
ceph balancer execute
ceph config set mgr mgr/balancer/max_misplaced .07 # 7%
ceph tell 'osd.*' injectargs '--osd-recovery-max-active 4' #default 3
ceph tell 'osd.*' injectargs '--osd-max-backfills 16' #default 1
rados list-inconsistent-obj 6.7 --format=json-pretty #0.7 is pg id
ceph osd pool application enable volumes rbd