ceph命令行

Posted by Struggle on 2019-03-23

ceph常用命令行

1.crush常用操作

1
2
3
4
5
6
7
8
9
ceph-deploy --overwrite-conf config push c002
同步配置文件到集群,这个是修改my-cluster下的ceph.conf,而不是/etc/ceph/ceph.conf
ceph osd crush add-bucket node001-ssd host 创建host
ceph osd crush add-bucket ssd root 创建root
ceph osd crush create-or-move osd.1 x.xxxx host=node001-ssd 迁移osd到host
ceph osd crush move c001-ssd root=ssd 迁移host到root
ceph osd crush rule create-simple rule-ssd ssd host创建rule并添加root
ceph osd primary-affinity osd.0 0 修改为辅osd 1是主 0是辅
ceph osd pool create openstack 128 128 replicated rule-ssd 创建pool并设置规则

2.crush导入导出

1
2
3
4
5
ceph crush
ceph osd getcrushmap -o {compiled-crushmap-filename} 获取一个映射
crushtool -d {compiled-crushmap-filename} -o {decompiled-crushmap-filename} 编译成一个可以读取的文件
crushtool -c {decompiled-crush-map-filename} -o {compiled-crush-map-filename} 反编译
ceph osd setcrushmap -i {compiled-crushmap-filename} 导入到crush集群

L版ceph命令行

1
2
ceph osd pool set vmstatus crush_rule rule-ssd 设置pool的规则
ceph osd crush rule create-simple rule-sata sata rack 创建sata规则