{"id":1090,"date":"2019-05-16T16:28:09","date_gmt":"2019-05-16T13:28:09","guid":{"rendered":"https:\/\/artem.services\/?p=1090"},"modified":"2019-05-16T16:33:12","modified_gmt":"2019-05-16T13:33:12","slug":"elasticsearch-%d0%ba%d0%be%d0%bf%d0%b8%d1%80%d0%be%d0%b2%d0%b0%d1%82%d1%8c-%d1%81%d0%be%d0%b4%d0%b5%d1%80%d0%b6%d0%b8%d0%bc%d0%be%d0%b5-%d0%be%d0%b4%d0%bd%d0%be%d0%b3%d0%be-%d0%b4%d0%be%d0%bc%d0%b5","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1090","title":{"rendered":"Elasticsearch &#8212; \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-223 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo.png\" alt=\"\" width=\"4796\" height=\"1277\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo.png 4796w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo-300x80.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo-768x204.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo-1024x273.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo-954x254.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/Elasticsearch-Logo-1354x361.png 1354w\" sizes=\"(max-width: 4796px) 100vw, 4796px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 <a href=\"https:\/\/www.npmjs.com\/package\/elasticdump\" target=\"_blank\" rel=\"noopener noreferrer\">elasticdump<\/a><\/p>\n<p>\u0414\u043b\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u044b <strong>elasticdump<\/strong> \u043d\u0443\u0436\u043d\u0435\u043d <strong>npm<\/strong>, \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <strong>nodejs<\/strong> \u0438 <strong>npm<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nyum install -y gcc-c++ make\r\ncurl -sL https:\/\/rpm.nodesource.com\/setup_6.x | sudo -E bash -\r\nyum install nodejs\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <strong>elasticdump<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnpm install elasticdump -g\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <strong>old_instance<\/strong> \u0438 <strong>new_instance<\/strong> <strong>URL<\/strong> \u0441\u0432\u043e\u0438\u0445 <strong>ES<\/strong> \u0434\u043e\u043c\u0435\u043d\u043e\u0432.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF &gt;elastic_dump.sh\r\n#!\/bin\/bash\r\n\r\nold_instance=&quot;https:\/\/vpc-artem-old.eu-central-1.es.amazonaws.com&quot;\r\nnew_instance=&quot;https:\/\/vpc-artem-new.eu-central-1.es.amazonaws.com&quot;\r\n\r\nes_indexes=$(curl -s &quot;${old_instance}\/_cat\/indices&quot; | awk '{ print $3 }')\r\n\r\nfor index in $es_indexes; do\r\n  elasticdump \\\r\n    --input=&quot;${old_instance}\/${index}&quot; \\\r\n    --output=&quot;${new_instance}\/${index}&quot; \\\r\n    --type=mapping\r\n\r\n  elasticdump \\\r\n    --input=&quot;${old_instance}\/${index}&quot; \\\r\n    --output=&quot;${new_instance}\/${index}&quot; \\\r\n    --type=data\r\ndone\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nchmod +x elastic_dump.sh\r\n.\/elastic_dump.sh\r\n<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <strong>Elasticsearch<\/strong> \u0443 \u0432\u0430\u0441 \u0441\u0435\u0440\u0432\u0438\u0441 <strong>AWS<\/strong>, \u0442\u043e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 <strong>Elasticsearch<\/strong> \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 <strong>SecurityGroup<\/strong> \u0438 <strong>VPC<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n{\r\n  &quot;Version&quot;: &quot;2012-10-17&quot;,\r\n  &quot;Statement&quot;: [\r\n    {\r\n      &quot;Effect&quot;: &quot;Allow&quot;,\r\n      &quot;Principal&quot;: {\r\n        &quot;AWS&quot;: &quot;*&quot;\r\n      },\r\n      &quot;Action&quot;: &quot;es:*&quot;,\r\n      &quot;Resource&quot;: &quot;arn:aws:es:eu-central-1:XXXXXXXXXXXX:domain\/artem-old\/*&quot;\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>eu-central-1 &#8212; \u0440\u0435\u0433\u0438\u043e\u043d AWS<br \/>\nXXXXXXXXXXXX &#8212; ID \u0443\u043a\u0430\u0443\u043d\u0442\u0430 AWS<br \/>\nartem-old &#8212; \u0438\u043c\u044f Elasticsearch \u0434\u043e\u043c\u0435\u043d\u0430<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 elasticdump \u0414\u043b\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u044b elasticdump \u043d\u0443\u0436\u043d\u0435\u043d npm, \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nodejs \u0438 npm: &nbsp; \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c elasticdump: &nbsp; \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 old_instance \u0438 new_instance URL \u0441\u0432\u043e\u0438\u0445 ES \u0434\u043e\u043c\u0435\u043d\u043e\u0432. &nbsp; \u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c: \u0415\u0441\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 Elasticsearch &hellip; <a href=\"https:\/\/artem.services\/?p=1090\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Elasticsearch &#8212; \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[829,28,723],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1090"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1090"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1092,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions\/1092"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}