{"id":782,"date":"2017-05-03T02:04:58","date_gmt":"2017-05-03T02:04:58","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=782"},"modified":"2017-05-03T02:04:58","modified_gmt":"2017-05-03T02:04:58","slug":"ceph%e7%9a%84pool%e7%9a%84pg%e4%bf%ae%e6%94%b9%e5%80%bc%e7%9a%84%e8%ae%a1%e7%ae%97","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=782","title":{"rendered":"ceph\u7684pool\u7684pg\u4fee\u6539\u503c\u7684\u8ba1\u7b97"},"content":{"rendered":"<p><strong>pg\u7684\u4fee\u6539<\/strong><br \/>\n\u5f53\u6269\u5927pg num\u7684\u65f6\u5019\uff0c\u6709\u65f6\u5019\u4f1a\u9047\u5230\u62a5\u9519\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >ceph osd pool set rbd pg_num 4096\r\n Error E2BIG: specified pg_num 3500 is too large (creating 4096 new PGs \\\r\n on ~64 OSDs exceeds per-OSD max of 32)<\/pre>\n<p>\u9650\u5236pg spliting\u7684\u53c2\u6570\u6765\u6e90\u4e8emon_osd_max_split_count value\u3002<br \/>\n\u67e5\u770b\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre class=\"lang:default decode:true \" >#ceph daemon mon.ipmi1151 config get mon_osd_max_split_count\r\n{\r\n    \"mon_osd_max_split_count\": \"32\"\r\n}<\/pre>\n<p>\u8ba1\u7b97\u811a\u672c\uff1a<\/p>\n<pre class=\"lang:default decode:true \" >max_inc=`ceph daemon mon.ipmi1151 config get mon_osd_max_split_count 2&gt;&amp;1 \\\r\n  | tr -d '\\n ' | sed 's\/.*\"\\([[:digit:]]\\+\\)\".*\/\\1\/'`\r\npg_num=`ceph osd pool get wtest pg_num | cut -f2 -d: | tr -d ' '`\r\necho \"current pg_num value: $pg_num, max increment: $max_inc\"\r\nosd_num=`ceph osd ls |wc -l`\r\nnext_pg_num=\"$(($pg_num+$(($max_inc * $osd_num))))\"\r\necho \"allowed increment of pg_num: $next_pg_num\"<\/pre>\n<p>\u7ed3\u679c\u8f93\u51fa<\/p>\n<pre class=\"lang:default decode:true \" >current pg_num value: 512, max increment: 32\r\nallowed increment of pg_num: 800\r\n<\/pre>\n<p>block_size\u7684\u8ba1\u7b97<\/p>\n<pre class=\"lang:default decode:true \" >block_size = mon_osd_max_split_count * n_osds.\r\n\r\n( Target PGs per OSD ) x ( OSD # ) x ( %Data )\r\n-------------------------------------------------\r\n                     ( Size )<\/pre>\n<p>If the value of the above calculation is less than the value of ( OSD# ) \/ ( Size ), then the value is updated to the value of ( OSD# ) \/ ( Size ). This is to ensure even load \/ data distribution by allocating at least one Primary or Secondary PG to every OSD for every Pool.<br \/>\nThe output value is then rounded to the nearest power of 2.<br \/>\nTip: The nearest power of 2 provides a marginal improvement in efficiency of the CRUSH algorithm.<br \/>\nIf the nearest power of 2 is more than 25% below the original value, the next higher power of 2 is used.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>pg\u7684\u4fee\u6539 \u5f53\u6269\u5927pg num\u7684\u65f6\u5019\uff0c\u6709\u65f6\u5019\u4f1a\u9047\u5230&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[84],"tags":[180,167],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/782"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=782"}],"version-history":[{"count":1,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/782\/revisions"}],"predecessor-version":[{"id":783,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/782\/revisions\/783"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}