{"id":3658,"date":"2022-08-02T09:26:09","date_gmt":"2022-08-02T01:26:09","guid":{"rendered":"http:\/\/www.chenlianfu.com\/?p=3658"},"modified":"2022-08-03T10:47:21","modified_gmt":"2022-08-03T02:47:21","slug":"%e6%8f%90%e5%8d%87ceph-pg-scrub%e7%9a%84%e9%80%9f%e5%ba%a6","status":"publish","type":"post","link":"http:\/\/www.chenlianfu.com\/?p=3658","title":{"rendered":"\u63d0\u5347CEPH PG scrub\u7684\u901f\u5ea6"},"content":{"rendered":"\n<p>CEPH\u4f1a\u5b9a\u671f\uff08\u9ed8\u8ba4\u6bcf\u4e2a\u661f\u671f\u4e00\u6b21\uff09\u5bf9\u6240\u6709\u7684PGs\u8fdb\u884cscrub\uff0c\u5373\u901a\u8fc7\u68c0\u6d4bPG\u4e2d\u5404\u4e2aosds\u4e2d\u6570\u636e\u662f\u5426\u4e00\u81f4\u6765\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u3002<\/p>\n\n\n\n<p>\u5f53CEPH\u66f4\u6362\u4e00\u5757\u574f\u786c\u76d8\uff0c\u8fdb\u884c\u6570\u636e\u4fee\u590d\u540e\uff0c\u51fa\u73b0\u4e86\u5927\u91cf\u7684PGs\u4e0d\u80fd\u53ca\u65f6\u8fdb\u884cscrub\uff0c\u751a\u81f3\u6709\u4e9bPGs\u6570\u636e\u4e0d\u4e00\u81f4\uff0c\u5bfc\u81f4CEPH\u7cfb\u7edf\u62a5\u8b66\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  cluster:\n    id:     8f1c1f24-59b1-11eb-aeb6-f4b78d05bf17\n    health: HEALTH_ERR\n            6 scrub errors\n            Possible data damage: 5 pgs inconsistent\n            1497 pgs not deep-scrubbed in time\n            1466 pgs not scrubbed in time\n\n  services:\n    mon: 5 daemons, quorum ceph101,ceph103,ceph107,ceph109,ceph105 (age 5d)\n    mgr: ceph107.gtrmmh(active, since 9d), standbys: ceph101.qpghiy\n    mds: cephfs:3 {0=cephfs.ceph106.hggsge=up:active,1=cephfs.ceph104.zhkcjt=up:active,2=cephfs.ceph102.imxzno=up:active} 1 up:standby\n    osd: 360 osds: 360 up (since 5d), 360 in (since 5d)\n\n  data:\n    pools:   4 pools, 10273 pgs\n    objects: 331.80M objects, 560 TiB\n    usage:   1.1 PiB used, 4.2 PiB \/ 5.2 PiB avail\n    pgs:     10261 active+clean\n             7     active+clean+scrubbing+deep\n             5     active+clean+inconsistent\n\n  io:\n    client:   223 MiB\/s rd, 38 MiB\/s wr, 80 op\/s rd, 12 op\/s wr\n<\/pre>\n\n\n\n<p>\u6b64\u65f6\uff0c\u9700\u8981\u63d0\u9ad8\u5bf9PGs\u7684scrub\u901f\u5ea6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e00\u4e2aOSD\u8fd1\u80fd\u540c\u65f6\u8fdb\u884c\u4e00\u4e2ascrub\u64cd\u4f5c\u4e14\u4ec5\u5f53\u4e3b\u673a\u4f4e\u4e8e0.5\u65f6\u624d\u8fdb\u884cscrub\u64cd\u4f5c\u3002\u6211\u8fd0\u7ef4\u7684CEPH\u7cfb\u7edf\u4e00\u4e2aPG\u5bf9\u5e9410\u4e2aOSDs\uff0c\u6bcf\u4e2aOSD\u4ec5\u80fd\u540c\u65f6\u8fdb\u884c\u4e00\u4e2ascrub\u64cd\u4f5c\uff0c\u5bfc\u81f4\u5927\u91cfscrub\u64cd\u4f5c\u9700\u8981\u7b49\u5f85\uff0c\u800c\u540c\u65f6\u8fdb\u884c\u7684scrub\u64cd\u4f5c\u6570\u91cf\u4e00\u822c\u4e3a8\u4e2a\u3002\u56e0\u6b64\u9700\u8981\u5728\u5404\u53f0\u5b58\u50a8\u670d\u52a1\u5668\u4e0a\u5bf9\u5176OSDs\u8fdb\u884c\u53c2\u6570\u4fee\u6539\uff0c\u6765\u63d0\u9ad8scrub\u901f\u5ea6\u3002<\/p>\n\n\n\n<p>osd_max_scrubs\u53c2\u6570\u7528\u4e8e\u8bbe\u7f6e\u5355\u4e2aOSD\u540c\u65f6\u8fdb\u884c\u7684\u6700\u5927scrub\u64cd\u4f5c\u6570\u91cf\uff1bosd_scrub_load\u53c2\u6570\u8bbe\u7f6e\u8d1f\u8f7d\u9608\u503c\u3002\u4e3b\u8981\u4fee\u6539\u4ee5\u4e0a\u4e24\u4e2a\u53c2\u6570\u6765\u63d0\u9ad8scrub\u901f\u5ea6\uff0c\u5176\u9ed8\u8ba4\u503c\u4e3a1\u548c0.5\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u5bf9ceph101\u4e3b\u673a\u4e2d\u7684\u6240\u6709OSDs\u8fdb\u884c\u53c2\u6570\u4fee\u6539\uff1a<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u83b7\u53d6ceph101\u4e2d\u6240\u6709\u7684OSD\u4fe1\u606f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ceph osd dump | grep `grep ceph101 \/etc\/hosts | perl -ne 'print $1 if m\/(\\d\\S*)\/'` | perl -ne 'print \"$1\\n\" if m\/(osd.\\d+)\/' &gt; \/tmp\/osd.list\n<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\uff0c\u5bf9\u6240\u6709OSD\u7684\u53c2\u6570\u8fdb\u884c\u6279\u91cf\u4fee\u6539\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for i in `cat \/tmp\/osd.list`\ndo\n    ceph tell $i injectargs --osd_max_scrubs=10 --osd_scrub_load_threshold=10\ndone<\/code><\/pre>\n\n\n\n<p>\u68c0\u67e5\u4fee\u6539\u540e\u7684\u6548\u679c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for i in `cat \/tmp\/osd.list`\ndo\n    echo $i\n    ceph daemon $i config show | egrep \"osd_max_scrubs|osd_scrub_load\"\ndone\n<\/code><\/pre>\n\n\n\n<p>\u5bf9\u6240\u6709\u7684CEPH\u4e3b\u673a\u8fdb\u884c\u4e0a\u8ff0\u4fee\u6539\u540e\uff0c\u540c\u65f6\u8fdb\u884cscrub\u7684\u6570\u91cf\u63d0\u9ad8\u4e8630\u500d\uff0c\u5e76\u4e14\u4f7f\u7528top\u547d\u4ee4\u53ef\u4ee5\u770b\u5230ceph-osd\u8fdb\u7a0b\u5bf9CPU\u7684\u8d44\u6e90\u6d88\u8017\u660e\u663e\u4e0a\u5347\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">  cluster:\n    id:     8f1c1f24-59b1-11eb-aeb6-f4b78d05bf17\n    health: HEALTH_ERR\n            6 scrub errors\n            Possible data damage: 5 pgs inconsistent\n            1285 pgs not deep-scrubbed in time\n            1208 pgs not scrubbed in time\n            1 slow ops, oldest one blocked for 37 sec, daemons [osd.124,osd.352] have slow ops.\n\n  services:\n    mon: 5 daemons, quorum ceph101,ceph103,ceph107,ceph109,ceph105 (age 5d)\n    mgr: ceph107.gtrmmh(active, since 9d), standbys: ceph101.qpghiy\n    mds: cephfs:3 {0=cephfs.ceph106.hggsge=up:active,1=cephfs.ceph104.zhkcjt=up:active,2=cephfs.ceph102.imxzno=up:active} 1 up:standby\n    osd: 360 osds: 360 up (since 5d), 360 in (since 5d)\n\n  data:\n    pools:   4 pools, 10273 pgs\n    objects: 331.80M objects, 560 TiB\n    usage:   1.1 PiB used, 4.2 PiB \/ 5.2 PiB avail\n    pgs:     10041 active+clean\n             152   active+clean+scrubbing+deep\n             75    active+clean+scrubbing\n             3     active+clean+scrubbing+deep+inconsistent+repair\n             2     active+clean+inconsistent\n\n  io:\n    client:   65 MiB\/s rd, 4.2 MiB\/s wr, 21 op\/s rd, 2 op\/s wr\n<\/pre>\n\n\n\n<p>\u6b64\u5916\uff0c\u6ce8\u610f\uff1a\uff081\uff09\u63d0\u9ad8scrub\u7684\u5e76\u884c\u6570\u53ef\u80fd\u5bf9CEPH\u96c6\u7fa4\u5185\u7f51\u7684\u7f51\u901f\u8981\u6c42\u8f83\u9ad8\uff0c\u63a8\u8350\u4f7f\u752810GE\u4ee5\u4e0a\u4ea4\u6362\u673a\u3002\uff082\uff09\u6761scrub\u7684\u5e76\u884c\u6570\uff0c\u4f1a\u5bfc\u81f4\u4e00\u4e2aOSD\u5bf9\u5e94\u7684\u786c\u76d8\u540c\u65f6\u5e76\u884c\u8bfb\u53d6\u7684\u64cd\u4f5c\u6570\u91cf\u8f83\u9ad8\uff0c\u5f53\u5bfc\u81f4\u78c1\u76d8100%\u88ab\u4f7f\u7528\u65f6\uff0c\u53ef\u80fd\u78c1\u76d8\u7684\u5229\u7528\u6548\u7387\u5e76\u4e0d\u9ad8\uff0c\u56e0\u6b64\u4e0d\u63a8\u8350\u5c06 osd_max_scrubs\u53c2\u6570\u8c03\u8282\u523010\u4ee5\u4e0a\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e24\u4e2a\u661f\u671f\u5185\uff08\u5f53\u524d\u65f6\u95f42022-08-03\uff09\u672a\u8fdb\u884cdeep-scrubbed\uff0c\u5df2\u7ecf\u6709\u62a5\u8b66\u4fe1\u606f\u7684PGs\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ceph pg dump | perl -e 'while (&lt;&gt;) { @_ = split \/\\s+\/; $pg{$_&#91;0]} = $1 if ($_&#91;22] =~ m\/2022-07-(\\d+)\/ &amp;&amp; $1 &lt;= 21); } foreach ( sort {$pg{$a} &lt;=&gt; $pg{$b}} keys %pg ) { print \"ceph pg deep-scrub $_; sleep 30;\\n\"; }' &gt; for_deep_scrub.list\n\nsh for_deep_scrub.list\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CEPH\u4f1a\u5b9a\u671f\uff08\u9ed8\u8ba4\u6bcf\u4e2a\u661f\u671f\u4e00\u6b21\uff09\u5bf9\u6240\u6709\u7684PGs\u8fdb\u884cscrub\uff0c\u5373\u901a\u8fc7\u68c0\u6d4bPG\u4e2d &hellip; <a href=\"http:\/\/www.chenlianfu.com\/?p=3658\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3658"}],"collection":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3658"}],"version-history":[{"count":7,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3658\/revisions"}],"predecessor-version":[{"id":3668,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/3658\/revisions\/3668"}],"wp:attachment":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3658"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}