CEPH POOL MIGRATION

版权声明:本博客系博主原创或转载,允许转载,但请保留原文出处。 https://blog.csdn.net/heivy/article/details/51134018

CEPH POOL MIGRATION

从一个资源池迁移到另一个资源池,特别是资源池参数不可修改的,比如:从replicated pool 迁移到 EC pool,缩减 PGs 数量。

最简方法

ool=testpool
ceph osd pool create $pool.new 4096 4096 erasure default
rados cppool $pool $pool.new
ceph osd pool rename $pool $pool.old
ceph osd pool rename $pool.new $pool

N: 对于 EC pools可能会报错:“error copying pool testpool => newpool: (95) Operation not supported”.

使用 cache tier

使用时要小心,先做测试再用于生产环境

以相反的顺序使用 cache tier

举例:有2个pool 现在的testpool 和新的 newpool

1、安装 cache tier

ceph osd tier add newpool testpool --force-nonempty
ceph osd tier cache-mode testpool forward

在命令 `ceph osd dump` 下输出下面类似内容:

--> pool 58 'testpool' replicated size 3 .... tier_of 80

2、强制迁移所有对象到 newpool

rados -p testpool cache-flush-evict-all

3、转换所有的客户端到 newpool

(可以提前做这一步,比如在 cache pool 建立之后)如果所有的数据没有在 newpool 中激活,
就需要指定一个覆盖图在 oldpool 中搜索 对象

ceph osd tier set-overlay newpool testpool

ceph osd dump 可以看到类似下面的内容:

--> pool 80 'newpool' replicated size 3 .... tiers 58 read_tier 58 write_tier 58

现在就可以设置所有的客户端具有 访问newpool 中对象的权限

4、移除覆盖图和 oldpool

ceph osd tier remove-overlay newpool
ceph osd tier remove newpool testpool

使用 Rados 导入导出

需要一个临时的本地文件夹

rados export --create testpool tmp_dir
    [exported]     rb.0.4975.2ae8944a.000000002391
    [exported]     rb.0.4975.2ae8944a.000000004abc
    [exported]     rb.0.4975.2ae8944a.0000000018ce
    ...

rados import tmp_dir newpool

    # Stop All IO
    # And redo a sync of modified objects

rados export --workers 5 testpool tmp_dir
rados import --workers 5 tmp_dir newpool

本文出自“he ivy”的博客,转载请务必保留此出处:http://blog.csdn.net/heivy/article/details/51134018

猜你喜欢

转载自blog.csdn.net/heivy/article/details/51134018