{"id":160,"date":"2024-08-15T21:29:39","date_gmt":"2024-08-15T13:29:39","guid":{"rendered":"https:\/\/www.dbyh.top\/?p=160"},"modified":"2024-08-15T21:29:39","modified_gmt":"2024-08-15T13:29:39","slug":"elasticsearch%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/www.dbyh.top\/index.php\/2024\/08\/15\/elasticsearch%e4%bc%98%e5%8c%96\/","title":{"rendered":"Elasticsearch\u4f18\u5316"},"content":{"rendered":"\n<p>Elasticsearch \u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5206\u5e03\u5f0f\u641c\u7d22\u548c\u5206\u6790\u5f15\u64ce\uff0c\u6027\u80fd\u8c03\u4f18\u5bf9\u4e8e\u786e\u4fdd\u5176\u9ad8\u6548\u8fd0\u884c\u81f3\u5173\u91cd\u8981\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u89c1\u7684 Elasticsearch \u6027\u80fd\u8c03\u4f18\u7b56\u7565\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u786c\u4ef6\u8d44\u6e90\u4f18\u5316<br>CPU: Elasticsearch \u662f\u4e00\u4e2a CPU \u5bc6\u96c6\u578b\u5e94\u7528\u3002\u786e\u4fdd\u8282\u70b9\u7684 CPU \u8d44\u6e90\u8db3\u591f\uff0c\u5c24\u5176\u662f\u5728\u9ad8\u67e5\u8be2\u8d1f\u8f7d\u4e0b\u3002\u591a\u6838\u5fc3 CPU \u80fd\u591f\u63d0\u5347\u6027\u80fd\u3002<br>\u5185\u5b58: Elasticsearch \u5bf9\u5185\u5b58\u7684\u9700\u6c42\u8f83\u9ad8\u3002\u786e\u4fdd JVM \u5806\u5185\u5b58\u8bbe\u7f6e\u5408\u7406\uff0c\u901a\u5e38\u8bbe\u7f6e\u4e3a\u7cfb\u7edf\u5185\u5b58\u7684 50% \u5de6\u53f3\uff0c\u4f46\u4e0d\u8d85\u8fc7 30 GB\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574 jvm.options \u6587\u4ef6\u4e2d\u7684 -Xms \u548c -Xmx \u53c2\u6570\u6765\u8bbe\u7f6e\u5806\u5185\u5b58\u5927\u5c0f\u3002\u6ce8\u610f\uff0cJVM \u5806\u5185\u5b58\u5e94\u5c0f\u4e8e\u7269\u7406\u5185\u5b58\u7684\u4e00\u534a\uff0c\u4ee5\u786e\u4fdd\u7cfb\u7edf\u6709\u8db3\u591f\u7684\u5185\u5b58\u7528\u4e8e\u7f13\u5b58\u548c\u5176\u4ed6\u64cd\u4f5c\u3002<br>\u78c1\u76d8: \u9009\u62e9\u9ad8\u6027\u80fd\u7684 SSD \u78c1\u76d8\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8 Elasticsearch \u7684 I\/O \u6027\u80fd\u3002\u786e\u4fdd\u78c1\u76d8\u6709\u8db3\u591f\u7684\u7a7a\u95f4\uff0c\u5e76\u4e14\u78c1\u76d8 I\/O \u4e0d\u6210\u4e3a\u74f6\u9888\u3002<\/li>\n\n\n\n<li>JVM \u8bbe\u7f6e<br>\u5806\u5185\u5b58\u5927\u5c0f: \u8bbe\u7f6e\u9002\u5f53\u7684\u5806\u5185\u5b58\u5927\u5c0f\u53ef\u4ee5\u907f\u514d\u9891\u7e41\u7684\u5783\u573e\u56de\u6536\uff08GC\uff09\u3002\u5806\u5185\u5b58\u8fc7\u5927\u4f1a\u5bfc\u81f4\u957f\u65f6\u95f4\u7684 GC \u6682\u505c\uff0c\u5806\u5185\u5b58\u8fc7\u5c0f\u5219\u53ef\u80fd\u5bfc\u81f4\u9891\u7e41\u7684 GC\u3002<br>GC \u7b56\u7565: \u4f7f\u7528\u9002\u5f53\u7684\u5783\u573e\u56de\u6536\u5668\uff08\u5982 G1GC\uff09\u53ef\u4ee5\u6539\u5584\u6027\u80fd\u3002\u9ed8\u8ba4\u7684 G1GC \u901a\u5e38\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff0c\u4f46\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u8c03\u4f18\u3002<\/li>\n\n\n\n<li>\u7d22\u5f15\u914d\u7f6e<br>\u5206\u7247\u548c\u526f\u672c: \u6839\u636e\u6570\u636e\u91cf\u548c\u67e5\u8be2\u9700\u6c42\u914d\u7f6e\u5408\u7406\u6570\u91cf\u7684\u5206\u7247\u548c\u526f\u672c\u3002\u8fc7\u591a\u7684\u5206\u7247\u4f1a\u5bfc\u81f4\u7ba1\u7406\u5f00\u9500\u589e\u52a0\uff0c\u8fc7\u5c11\u7684\u5206\u7247\u4f1a\u5f71\u54cd\u5e76\u53d1\u5904\u7406\u80fd\u529b\u3002\u526f\u672c\u7684\u6570\u91cf\u5f71\u54cd\u641c\u7d22\u6027\u80fd\uff0c\u4f46\u589e\u52a0\u526f\u672c\u4f1a\u589e\u52a0\u5b58\u50a8\u9700\u6c42\u3002<br>\u6620\u5c04\u8bbe\u7f6e: \u5408\u7406\u8bbe\u8ba1\u7d22\u5f15\u7684\u6620\u5c04\uff08mapping\uff09\uff0c\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5b57\u6bb5\u548c\u5206\u6790\u5668\uff08analyzer\uff09\u3002\u786e\u4fdd\u5b57\u6bb5\u7c7b\u578b\u4e0e\u5b9e\u9645\u6570\u636e\u5339\u914d\uff0c\u4ee5\u4f18\u5316\u5b58\u50a8\u548c\u67e5\u8be2\u6027\u80fd\u3002<br>\u6570\u636e\u5206\u7247: \u4e3a\u4e86\u4f18\u5316\u6027\u80fd\uff0c\u53ef\u4ee5\u5bf9\u6570\u636e\u8fdb\u884c\u5206\u7247\u3002\u4f7f\u7528\u65f6\u95f4\u6233\u7b49\u65b9\u5f0f\u5c06\u6570\u636e\u5212\u5206\u5230\u4e0d\u540c\u7684\u7d22\u5f15\u4e2d\uff0c\u4ee5\u907f\u514d\u5355\u4e2a\u7d22\u5f15\u8fc7\u5927\u3002<\/li>\n\n\n\n<li>\u67e5\u8be2\u4f18\u5316<br>\u7f13\u5b58: \u5229\u7528 Elasticsearch \u7684\u7f13\u5b58\u673a\u5236\uff08\u5982\u67e5\u8be2\u7f13\u5b58\uff09\u6765\u63d0\u9ad8\u67e5\u8be2\u6027\u80fd\u3002\u5408\u7406\u914d\u7f6e\u7f13\u5b58\u8bbe\u7f6e\uff0c\u5e76\u76d1\u63a7\u7f13\u5b58\u547d\u4e2d\u7387\u3002<br>\u907f\u514d\u6602\u8d35\u67e5\u8be2: \u907f\u514d\u4f7f\u7528\u590d\u6742\u7684\u67e5\u8be2\uff0c\u5982\u9ad8 cardinality \u7684\u805a\u5408\u67e5\u8be2\u3002\u5c1d\u8bd5\u4f18\u5316\u67e5\u8be2\u7ed3\u6784\uff0c\u4f7f\u7528\u8fc7\u6ee4\u5668\u800c\u4e0d\u662f\u67e5\u8be2\u6765\u51cf\u5c11\u8ba1\u7b97\u91cf\u3002<br>\u5206\u9875: \u5bf9\u4e8e\u5927\u6570\u636e\u96c6\uff0c\u5206\u9875\u67e5\u8be2\uff08\u4f7f\u7528 from \u548c size \u53c2\u6570\uff09\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u3002\u4f7f\u7528 search_after \u8fdb\u884c\u6df1\u5ea6\u5206\u9875\u53ef\u4ee5\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n\n\n\n<li>\u96c6\u7fa4\u7ba1\u7406<br>\u8282\u70b9\u5206\u914d: \u6839\u636e\u8d1f\u8f7d\u5c06\u6570\u636e\u5747\u5300\u5206\u914d\u5230\u96c6\u7fa4\u4e2d\u7684\u5404\u4e2a\u8282\u70b9\u4e0a\u3002\u907f\u514d\u5355\u4e2a\u8282\u70b9\u6210\u4e3a\u74f6\u9888\u3002<br>\u96c6\u7fa4\u72b6\u6001\u76d1\u63a7: \u4f7f\u7528 Elasticsearch \u7684\u76d1\u63a7\u5de5\u5177\uff08\u5982 Kibana \u7684\u76d1\u63a7\u529f\u80fd\uff09\u6765\u5b9e\u65f6\u76d1\u63a7\u96c6\u7fa4\u72b6\u6001\uff0c\u53ca\u65f6\u53d1\u73b0\u5e76\u89e3\u51b3\u6027\u80fd\u95ee\u9898\u3002<br>\u96c6\u7fa4\u5065\u5eb7: \u5b9a\u671f\u68c0\u67e5\u96c6\u7fa4\u7684\u5065\u5eb7\u72b6\u6001\uff0c\u89e3\u51b3\u6f5c\u5728\u7684\u8282\u70b9\u6545\u969c\u3001\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u7b49\u95ee\u9898\u3002<\/li>\n\n\n\n<li>\u5b9a\u671f\u7ef4\u62a4<br>\u4f18\u5316\u7d22\u5f15: \u5b9a\u671f\u8fdb\u884c\u7d22\u5f15\u4f18\u5316\uff08\u5982 Force Merge\uff09\uff0c\u4ee5\u51cf\u5c11\u6bb5\uff08segments\uff09\u7684\u6570\u91cf\uff0c\u4ece\u800c\u63d0\u5347\u67e5\u8be2\u6027\u80fd\u3002<br>\u5220\u9664\u8fc7\u671f\u6570\u636e: \u5b9a\u671f\u5220\u9664\u4e0d\u518d\u9700\u8981\u7684\u6570\u636e\uff0c\u4ee5\u8282\u7701\u5b58\u50a8\u7a7a\u95f4\u548c\u63d0\u9ad8\u67e5\u8be2\u6027\u80fd\u3002<\/li>\n\n\n\n<li>\u7248\u672c\u66f4\u65b0<br>\u5347\u7ea7 Elasticsearch: \u5b9a\u671f\u66f4\u65b0 Elasticsearch \u5230\u6700\u65b0\u7248\u672c\uff0c\u4ee5\u5229\u7528\u6027\u80fd\u6539\u8fdb\u548c\u65b0\u7279\u6027\u3002\u65b0\u7248\u672c\u901a\u5e38\u5305\u542b\u6027\u80fd\u4f18\u5316\u548c bug \u4fee\u590d\u3002<\/li>\n\n\n\n<li>\u7f51\u7edc\u914d\u7f6e<br>\u7f51\u7edc\u5ef6\u8fdf: \u786e\u4fdd\u8282\u70b9\u4e4b\u95f4\u7684\u7f51\u7edc\u5ef6\u8fdf\u5c3d\u53ef\u80fd\u4f4e\u3002\u9ad8\u5ef6\u8fdf\u4f1a\u5f71\u54cd\u96c6\u7fa4\u7684\u6574\u4f53\u6027\u80fd\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5206\u5e03\u5f0f\u641c\u7d22\u548c\u5206\u6790\u5f15\u64ce\uff0c\u6027\u80fd\u8c03\u4f18\u5bf9\u4e8e\u786e\u4fdd\u5176\u9ad8\u6548\u8fd0\u884c\u81f3\u5173\u91cd\u8981\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-160","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/posts\/160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":1,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/posts\/160\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/media?parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/categories?post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbyh.top\/index.php\/wp-json\/wp\/v2\/tags?post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}