1.问题描述:
在使用rook安装单节点ceph后,出现如下问题:
2.解决:
进行toolbox容器:
kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- bash
将crush map导出:
$ ceph osd getcrushmap -o /etc/ceph/crushmap
6
将crush map反编译为可读模式:$ crushtool -d /etc/ceph/crushmap -o /etc/ceph/crushmap.txt
修改curshmap,主要是修改OSD级别:
将step chooseleaf firstn 0 type host 修改为:step chooseleaf firstn 0 type osd
[rook@rook-ceph-tools-5c6844fcd5-wm6js /]$ vi /etc/ceph/crushmap.txt # begin crush map tunable choose_local_tries 0 tunable choose_local_fallback_tries 0 tunable choose_total_tries 50 tunable chooseleaf_descend_once 1 tunable chooseleaf_vary_r 1 tunable chooseleaf_stable 1 tunable straw_calc_version 1 tunable allowed_bucket_algs 54 # devices device 0 osd.0 class hdd device 1 osd.1 class hdd device 2 osd.2 class hdd device 3 osd.3 class hdd # types type 0 osd type 1 host type 2 chassis type 3 rack type 4 row type 5 pdu type 6 pod type 7 room type 8 datacenter type 9 zone type 10 region type 11 root # buckets host worker01 { id -3 # do not change unnecessarily id -4 class hdd # do not change unnecessarily # weight 4.362 alg straw2 hash 0 # rjenkins1 item osd.1 weight 1.090 item osd.2 weight 1.090 item osd.3 weight 1.090 item osd.0 weight 1.090 } root default { id -1 # do not change unnecessarily id -2 class hdd # do not change unnecessarily # weight 4.362 alg straw2 hash 0 # rjenkins1 item worker01 weight 4.362 } # rules rule replicated_rule { id 0 type replicated min_size 1 max_size 10 step take default #将step chooseleaf firstn 0 type host 修改为:step chooseleaf firstn 0 type osd step chooseleaf firstn 0 type osd step emit } rule replicapool { id 1 type replicated min_size 1 max_size 10 step take default step choose firstn 0 type osd step emit } # end crush map
[rook@rook-ceph-tools-5c6844fcd5-wm6js ~]$ crushtool -c /etc/ceph/crushmap.txt -o /etc/ceph/crushmap-new
[rook@rook-ceph-tools-5c6844fcd5-wm6js ~]$ ceph osd setcrushmap -i /etc/ceph/crushmap-new
7验证:
[rook@rook-ceph-tools-5c6844fcd5-wm6js ~]$ ceph -s
cluster:
id: 7d358d90-4176-4a8b-9c8c-f9d979df77a3
health: HEALTH_WARN
1 pool(s) have no replicas configured
services:
mon: 1 daemons, quorum a (age 29m)
mgr: a(active, since 28m)
osd: 4 osds: 4 up (since 12m), 4 in (since 28m)
data:
pools: 2 pools, 33 pgs
objects: 6 objects, 35 B
usage: 21 MiB used, 4.4 TiB / 4.4 TiB avail
pgs: 33 active+clean