{"id":446,"date":"2022-09-16T23:55:33","date_gmt":"2022-09-16T15:55:33","guid":{"rendered":"http:\/\/nas.hepcloud.top:7000\/?p=446"},"modified":"2022-11-01T22:39:12","modified_gmt":"2022-11-01T14:39:12","slug":"%e4%b8%83%e3%80%81docker%e5%ae%89%e8%a3%85elasticsearch8-4-1%e6%9c%80%e6%96%b0%e7%89%88%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/www.huerpu.cc:7000\/?p=446","title":{"rendered":"\u4e03\u3001docker\u5b89\u88c5elasticsearch8.4.1\u6700\u65b0\u7248\u670d\u52a1\u5668"},"content":{"rendered":"<h3>\u4e03\u3001docker\u5b89\u88c5elasticsearch8.4.1\u6700\u65b0\u7248\u670d\u52a1\u5668<\/h3>\n<h3>\u4e00\u3001\u62c9\u53d6\u5e76\u8fd0\u884celasticsearch8.4.1\u955c\u50cf<\/h3>\n<pre><code class=\"language-shell\">#\u6dfb\u52a0\u591a\u4e2a\u56fd\u5185\u6e90\nvim \/etc\/docker\/daemon.json\n#\u6dfb\u52a0\u4e0b\u9762\u7684\u56fd\u5185\u6e90\uff0c\u53ef\u6839\u636e\u9700\u8981\u81ea\u884c\u6dfb\u52a0\u591a\u4e2a\n{\n    &quot;registry-mirrors&quot;: [&quot;http:\/\/hub-mirror.c.163.com&quot;, &quot;https:\/\/registry.docker-cn.com&quot;]\n}\n\n#\u91cd\u542fdocker\nsystemctl daemon-reload \nsystemctl restart docker\n\n#\u62c9\u53d6elasticsearch:8.4.1\u955c\u50cf\uff0c\u5982\u679c\u4f7f\u7528docker pull elasticsearch\u53ea\u4f1a\u62c9\u53d65.6.12\u7248\u672c\u7684\ndocker pull elasticsearch:8.4.1\n\n#\u8bbe\u7f6e vm.max_map_count\uff0c\u6dfb\u52a0\u4e00\u4e2a\u9009\u9879 vm.max_map_count = 262144\nvim \/etc\/sysctl.conf\nsudo sysctl -p\n\n#\u521b\u5efa\u53ef\u7528\u7684\u7f51\u7edcelastic\ndocker network create elastic\n\n#\u8fd0\u884celasticsearch:8.4.1\ndocker run \\\n--name elasticsearch \\\n--net elastic \\\n-p 9200:9200 \\\n-e ES_JAVA_OPTS=&quot;-Xms1024m -Xmx1024m&quot; \\\n-idt elasticsearch:8.4.1\n\n#\u8fdb\u5165elasticsearch:8.4.1\u63a7\u5236\u53f0\ndocker exec -it elasticsearch \/bin\/bash\n\n#\u4fee\u6539\u5bc6\u7801\nbin\/elasticsearch-reset-password -u elastic\n\n#\u6b64\u65f6\u63a7\u5236\u53f0\u4f1a\u6709\u8f93\u51fa\u65b0\u4fee\u6539\u7684\u5bc6\u7801\n*59p26rYQoKGHCjwYYqj<\/code><\/pre>\n<p>\u8fd0\u884c\u622a\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/111.png\" alt=\"111.png\" \/><\/p>\n<h3>\u4e8c\u3001\u5b89\u88c5Multi Elasticsearch Head<\/h3>\n<p>\u5728chrome\u6d4f\u89c8\u5668\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684\u4e09\u4e2a\u70b9\uff0c\u7136\u540e\u9009\u62e9\u66f4\u591a\u5de5\u5177\u4e2d\u7684\u6269\u5c55\u7a0b\u5e8f\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/001.png\" alt=\"001.png\" \/><\/p>\n<p>\u6253\u5f00\u53f3\u4e0a\u89d2\u7684\u5f00\u53d1\u8005\u9009\u9879\uff0c\u7136\u540e\u70b9\u51fb\u5de6\u4e0b\u89d2\u7684\u6253\u5f00chrome\u5e94\u7528\u5546\u5e97\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/002.png\" alt=\"001.png\" \/><\/p>\n<p>\u641c\u7d22elasticsearch\uff0c\u5e76\u70b9\u51fb\u5b89\u88c5\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/003.png\" alt=\"001.png\" \/><\/p>\n<p>\u5b89\u88c5\u4e4b\u540e\uff0cchrome\u7684\u53f3\u4e0a\u89d2\u5c31\u4f1a\u591a\u4e00\u4e2a\u8fd9\u6837\u7684\u56fe\u6807\u3002\u70b9\u51fb\u8fd9\u4e2a\u56fe\u6807\u5c31\u53ef\u4ee5\u6253\u5f00elasticsearch head\u4e86\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/004.png\" alt=\"001.png\" \/><\/p>\n<p>\u8fd9\u91cc\u70b9\u51fbNew\u521b\u5efa\u4e00\u4e2a\u94fe\u63a5\uff0c\u8f93\u5165\u5bbf\u4e3b\u673aIP+9200\u7aef\u53e3\u53f7\uff0c\u6bd4\u5982\u6211\u7684https:\/\/192.168.31.161:9200\u3002\u6ce8\u610f\u8fd9\u91cc\u4e00\u5b9a\u662fhttps\u800c\u4e0d\u662fhttp\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/005.png\" alt=\"001.png\" \/><\/p>\n<p>\u67e5\u770belasticsearch\u7684\u7248\u672c\u53f7\u4e3a8.4.1\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/15\/006.png\" alt=\"001.png\" \/><\/p>\n<h3>\u4e09\u3001elasticsearch\u6269\u5145\u4e3a\u4e09\u4e2a\u8282\u70b9\u7684\u96c6\u7fa4<\/h3>\n<pre><code class=\"language-shell\">#\u8fdb\u5165\u521a\u624d\u542f\u52a8\u7684es\u83b7\u53d6token\ndocker exec -it elasticsearch \/usr\/share\/elasticsearch\/bin\/elasticsearch-create-enrollment-token -s node\n\n#\u8f93\u51fa\u7684\u5185\u5bb9\u5982\u4e0b\nroot@hep-server:~# docker exec -it elasticsearch \/usr\/share\/elasticsearch\/bin\/elasticsearch-create-enrollment-token -s node\neyJ2ZXIiOiI4LjQuMSIsImFkciI6WyIxNzIuMTcuMC4yOjkyMDAiXSwiZmdyIjoiOWM0ZjhlZWMxN2YyODBiZjU2ODE4ZTI1MjM2ZGFkOTE2OGExZjFjYzk2MWFmOWU0N2VkYWYwNWE3NTFiYmVlOSIsImtleSI6ImhmWDBRWU1CZWsxMXpQaTRQM3UxOjNmQkVKTXJ2VDJTZWl5X3FZUE5SNFEifQ==\nroot@hep-server:~#\n\n#\u96c6\u7fa4\u6269\u5145\u7684run\u547d\u4ee4\u5982\u4e0b\ndocker run \\\n-e ENROLLMENT_TOKEN=&quot;{{\u4e0a\u4e00\u6b65\u83b7\u53d6\u7684token}}&quot; \\\n-e ES_JAVA_OPTS=&quot;-Xms1024m -Xmx1024m&quot; \\\n--name elasticsearch-0002 \\\n--net elastic \\\n-e &quot;node.name=elasticsearch-0002&quot; \\\n-idt elasticsearch:8.4.1\n\n#\u542f\u52a8\u7b2c\u4e8c\u4e2aelasticsearch\ndocker run \\\n-e ENROLLMENT_TOKEN=&quot;eyJ2ZXIiOiI4LjQuMSIsImFkciI6WyIxNzIuMTcuMC4yOjkyMDAiXSwiZmdyIjoiOWM0ZjhlZWMxN2YyODBiZjU2ODE4ZTI1MjM2ZGFkOTE2OGExZjFjYzk2MWFmOWU0N2VkYWYwNWE3NTFiYmVlOSIsImtleSI6ImhmWDBRWU1CZWsxMXpQaTRQM3UxOjNmQkVKTXJ2VDJTZWl5X3FZUE5SNFEifQ==&quot; \\\n-e ES_JAVA_OPTS=&quot;-Xms1024m -Xmx1024m&quot; \\\n--name elasticsearch-02 \\\n--net elastic \\\n-e &quot;node.name=elasticsearch-02&quot; \\\n-idt elasticsearch:8.4.1\n\n#\u542f\u52a8\u7b2c\u4e09\u4e2aelasticsearch\ndocker run \\\n-e ENROLLMENT_TOKEN=&quot;eyJ2ZXIiOiI4LjQuMSIsImFkciI6WyIxNzIuMTcuMC4yOjkyMDAiXSwiZmdyIjoiOWM0ZjhlZWMxN2YyODBiZjU2ODE4ZTI1MjM2ZGFkOTE2OGExZjFjYzk2MWFmOWU0N2VkYWYwNWE3NTFiYmVlOSIsImtleSI6ImhmWDBRWU1CZWsxMXpQaTRQM3UxOjNmQkVKTXJ2VDJTZWl5X3FZUE5SNFEifQ==&quot; \\\n-e ES_JAVA_OPTS=&quot;-Xms1024m -Xmx1024m&quot; \\\n--name elasticsearch-03 \\\n--net elastic \\\n-e &quot;node.name=elasticsearch-03&quot; \\\n-idt elasticsearch:8.4.1\n<\/code><\/pre>\n<p>\u5237\u65b0elasticsearch head\u53ef\u4ee5\u770b\u5230elasticsearch-02\u548celasticsearch-03\u8282\u70b9\u4fe1\u606f\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/007.png\" alt=\"007.png\" \/><\/p>\n<h3>\u56db\u3001\u5b89\u88c5kibana<\/h3>\n<pre><code class=\"language-shell\">#\u62c9\u53d6kibana:8.4.1\u955c\u50cf\ndocker pull kibana:8.4.1\n\ndocker run \\\n--name kibana \\\n--net elastic \\\n-p 5601:5601 \\\n-idt kibana:8.4.1\n\n#\u67e5\u770b\u6240\u6709\u5bb9\u5668\uff0c\u7136\u540e\u590d\u5236kinaba\u7684\u5bb9\u5668ID\ndocker ps -a \n\n#\u6839\u636ekibana\u7684\u5bb9\u5668id\uff0c\u67e5\u770b\u65e5\u5fd7\ndocker logs -f e6db6df178cc<\/code><\/pre>\n<p>\u5728\u6d4f\u89c8\u5668\u8f93\u5165\u5bbf\u4e3b\u673aIP\u5730\u5740\u52a0\u4e0a5601\u7aef\u53e3\u53f7\uff0c\u6211\u8fd9\u91cc\u662f<code>http:\/\/192.168.31.161:5601\/<\/code>\u3002\u5e76\u628a\u4e0a\u9762\u6309\u7167elasticsearch\u7684token\u7c98\u8d34\u5230\u4e0b\u9762\u8f93\u5165\u6846\uff0c\u7136\u540e\u70b9\u51fbConfigure Elastic\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/image-20220916193447522.png\" alt=\"image-20220916193447522\" \/><\/p>\n<p>\u8fd9\u65f6\u5019\u4f1a\u51fa\u73b0\u9a8c\u8bc1\u7801\u7684\u8f93\u5165\u6846\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/image-20220916193606879.png\" alt=\"image-20220916193606879\" \/><\/p>\n<p>\u5728\u521a\u521a\u7684kibana\u7684\u63a7\u5236\u53f0\uff0c\u5c31\u4f1a\u6709\u9a8c\u8bc1\u7801\u7684\u63d0\u793a\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-shell\">[2022-09-16T11:30:23.582+00:00][INFO ][node] Kibana process configured with roles: [background_tasks, ui]\n[2022-09-16T11:30:37.768+00:00][INFO ][http.server.Preboot] http server running at http:\/\/0.0.0.0:5601\n[2022-09-16T11:30:37.823+00:00][INFO ][plugins-system.preboot] Setting up [1] plugins: [interactiveSetup]\n[2022-09-16T11:30:37.826+00:00][INFO ][preboot] &quot;interactiveSetup&quot; plugin is holding setup: Validating Elasticsearch connection configuration\u2026\n[2022-09-16T11:30:37.869+00:00][INFO ][root] Holding setup until preboot stage is completed.\ni Kibana has not been configured.\n\nGo to http:\/\/0.0.0.0:5601\/?code=923379 to get started.\n\nYour verification code is:  923 379 <\/code><\/pre>\n<p>\u6211\u4eec\u628a\u9a8c\u8bc1\u7801\u8f93\u5165\u8fdb\u53bb\uff0c\u70b9\u51fb\u9a8c\u8bc1\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/image-20220916194647224.png\" alt=\"image-20220916194647224\" \/><\/p>\n<p>\u7cfb\u7edf\u5c31\u5728\u9a8c\u8bc1\u4e2d\u5566<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/11111.png\" alt=\"11111\" \/><\/p>\n<p>\u9a8c\u8bc1\u5b8c\u6210\u4e4b\u540e\uff0c\u6211\u4eec\u8fd9\u91cc\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u7528\u6237\u540d\u5c31\u662felastic\uff0c\u5bc6\u7801\u5c31\u662f\u7b2c\u4e00\u6b65\u521b\u5efaelasticsearch\u7684\u5bc6\u7801*59p26rYQoKGHCjwYYqj\uff0c\u590d\u5236\u8fc7\u6765\u5c31\u597d\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/222222.png\" alt=\"222222\" \/><\/p>\n<p>\u8fd9\u91cc\u70b9\u51fbExplore on my own\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/33333.png\" alt=\"33333\" \/><\/p>\n<p>\u8fd9\u5c31\u53ef\u4ee5\u8fdb\u5165\u5230kibana\u7684\u4e3b\u754c\u9762\u5566\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/44444.png\" alt=\"44444\" \/><\/p>\n<p>\u70b9\u51fbDev Tools\u6309\u94ae\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/image-20220916233608652.png\" alt=\"image-20220916233608652\" \/><\/p>\n<p>\u8fd9\u91cc\u5c31\u53ef\u4ee5\u6109\u5feb\u5730\u64cd\u4f5celasticsearch\u5566\u3002<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/09\/16\/image-20220916233839247.png\" alt=\"image-20220916233839247\" \/><\/p>\n<p>\u5927\u529f\u544a\u6210\uff0cenjoy your elasticsearch\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e03\u3001docker\u5b89\u88c5elasticsearch8.4.1\u6700\u65b0\u7248\u670d\u52a1\u5668 \u4e00\u3001\u62c9\u53d6\u5e76\u8fd0\u884celasticsearch [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-446","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=446"}],"version-history":[{"count":2,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/446\/revisions"}],"predecessor-version":[{"id":456,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=\/wp\/v2\/posts\/446\/revisions\/456"}],"wp:attachment":[{"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huerpu.cc:7000\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}