0.引入
本文介绍如何配置cache pool tiering. cache pool的作用是提供可扩展的cache,用来缓存ceph的热点数据或者直接用来作为高速pool。如何建立一个cache pool:首先利用ssd盘做一个虚拟的bucket tree,
然后创建一个cache pool,设置其crush映射rule和相关配置,最后关联需要用到的pool到cache pool。
1.建立ssd bucket tree
这是新增ssd bucket(vrack)后的osd tree。其中osd.1 osd.0 osd.2使用的是ssd盘。如何创建将简单,无非是调整或新增osd到bucket tree下。
# ceph osd tree ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY -1 6.00000 root default -2 6.00000 room test -3 3.00000 rack r1 -7 1.00000 host H09 3 1.00000 osd.3 up 1.00000 1.00000 -9 1.00000 host H07 5 1.00000 osd.5 up 1.00000 1.00000 -10 1.00000 host H06 6 1.00000 osd.6 up 1.00000 1.00000 -4 3.00000 rack vrack -6 1.00000 host vh06 1 1.00000 osd.1 up 1.00000 1.00000 -8 1.00000 host vh07 2 1.00000 osd.2 up 1.00000 1.00000 -5 1.00000 host vh09 0 1.00000 osd.0 up 1.00000 1.00000
2.修改crushmap
#ceph osd getcrushmap -o map #crushtool -d map -o map.txt #vi map.txt 添加replicated_ruleset_cache crush策略,从vrack机架选择osd rule replicated_ruleset { ruleset 0 type replicated min_size 1 max_size 10 step take r1 step chooseleaf firstn 0 type host step emit } rule replicated_ruleset_cache { ruleset 1 type replicated min_size 1 max_size 10 step take vrack step chooseleaf firstn 0 type host step emit } #crushtool -c map.txt -o map.new #ceph osd setcrushmap -i map.new
3. 创建cache pool
指定新建的pool的crush rules 为replicated_ruleset_cache
#ceph osd pool create rbd.cache 128 128 #ceph osd pool set rbd.cache crush_ruleset 1
4. 为rbd pool添加cache pool
# ceph osd tier add rbd rbd.cache # ceph osd tier cache-mode rbd.cache writeback # ceph osd tier set-overlay rbd rbd.cache
5. 设置cache pool相关参数
参数含义请参考官网
# ceph osd pool set rbd.cache hit_set_type bloom # ceph osd pool set rbd.cache hit_set_count 1 # ceph osd pool set rbd.cache hit_set_period 1800 # ceph osd pool set rbd.cache target_max_bytes 30000000000 # ceph osd pool set rbd.cache min_read_recency_for_promote 1 # ceph osd pool set rbd.cache min_write_recency_for_promote 1 # ceph osd pool set rbd.cache cache_target_dirty_ratio .4 # ceph osd pool set rbd.cache cache_target_dirty_high_ratio .6 # ceph osd pool set rbd.cache cache_target_full_ratio .8
6. 参考文档
【CACHE POOL】http://docs.ceph.com/docs/master/dev/cache-pool/
时间: 2024-12-28 08:27:57