步骤1:提前关闭scrub和deep-scrub,任意节点执行:
ceph osd set noscrub
ceph osd set nodeep-scrub
步骤2:当没有pg在进行scrub和deep-scrub的时候,调整max_scrubs参数:
ceph tell osd.* injectargs --osd_max_scrubs=100
ceph tell mon.* injectargs --osd_max_scrubs=100
可以使用以下命令确认是否修改成功(X为执行命令的该节点所在的osd实际编号):
ceph daemon osd.X config show|grep max_scrubs
步骤3:根据ceph health detail 的输出找到需要修复的pg编号;
步骤4:执行修复命令:ceph pg repair PGID,且查看ceph –s有pg在进行repair
步骤5:等待pg修复完成,根据之前两个pg的修复情况可能会较长时间(2个小时以上)。
可以观察主osd的日志进行确认:
tailf /var/log/ceph/ceph-osd.X.log |grep fixed (当有fixed输出是表示修复成功)
步骤6:重复步骤3-步骤5修复其他pg,根据修复时间控制修复pg数量避免影响白天业务。
步骤7:结束修复之后将max_scrub值调回默认值:
ceph tell osd.* injectargs --osd_max_scrubs=1
ceph tell mon.* injectargs --osd_max_scrubs=1
可以使用以下命令确认是否修改成功:
ceph daemon osd.X config show|grep max_scrubs
步骤8:关开启scrub和deep-scrub,任意节点执行:
ceph osd unset noscrub
ceph osd unset nodeep-scrub