ceph command

deploy

cephadm

1
2
3
4
5
6
7
8
# step1 monitor
cephadm bootstrap --mon-ip *<mon-ip>*

# ceph shell
sudo ./cephadm shell

# You can access the Ceph CLI as following in case of multi-cluster or non-default config:
sudo /usr/sbin/cephadm shell --fsid <fsid> -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring

service

1
2
3
4
5
# check all vaild service
ceph orch ls

# check all vaild/invaild service
ceph orch ps

cluster

1
2
3
4
5
# method 1
ceph fsid

# method 2
cat /etc/ceph/ceph.conf | grep fsid

User

1
2
3
4
5
# check regular user key
ceph auth list

# check admin key
ceph auth get client.admin

health

1
ceph df

host

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# list host
ceph orch host ls --detail

# add host
ssh-copy-id -f -i /etc/ceph/ceph.pub root@*<new-host>*
ceph orch host add *<newhost>* [*<ip>*] [*<label1> ...*]
# e.g. ceph orch host add host2 10.10.0.102 --labels _admin

# remove host
ceph orch host drain *<host>*
ceph orch ps <host> # daemons on the host
ceph orch host rm <host> # remove the host from the cluster after all daemons have been removed

# add storage
ceph orch apply osd --all-available-devices

osd

1
2
3
4
5
6
7
8
9
10
11
12
13
# list
ceph orch device ls

# check
ceph ods tree

# Creating New OSDs
ceph orch apply osd --all-available-devices
# or
ceph orch daemon add osd *<host>*:*<device-path>*
# e.g.
ceph orch daemon add osd host1:/dev/sdb
ceph orch daemon add osd host1:data_devices=/dev/sda,/dev/sdb,db_devices=/dev/sdc,osds_per_device=2

pool

1
2
# list available pool
ceph osd pool ls

RGW

radosgw

1
2
3
4
5
6
7
8
9
10
11
12
# enable rgw
ceph mgr module enable rgw

# config rgw name e.g. foo
ceph orch apply rgw foo

# lable host
ceph orch host label add gwhost1 rgw # the 'rgw' label can be anything
ceph orch host label add gwhost2 rgw

# apply
ceph orch apply rgw foo '--placement=label:rgw count-per-host:2' --port=8000

radosgw-admin

1
2
3
4
5
6
7
8
9
10
# create user
radosgw-admin user create --uid=dongwei --display-name="Dongwei User"

# check user
radosgw-admin user info --uid=dongwei

# check bucket info
radosgw-admin bucket stats --bucket=<bucket-name>
or
radosgw-admin metadata get bucket:<bucket>

monitor

1
2
ceph mon dump
# <mon-ip>:6789

Ceph Object Gateway