{"id":302,"date":"2018-08-08T19:46:53","date_gmt":"2018-08-08T10:46:53","guid":{"rendered":"https:\/\/dong1lkim.oboki.net\/?p=302"},"modified":"2019-09-01T22:21:34","modified_gmt":"2019-09-01T13:21:34","slug":"elasticsearch-2-nodes-cluster-%ec%84%a4%ec%b9%98","status":"publish","type":"post","link":"https:\/\/oboki.net\/workspace\/data-engineering\/elasticsearch\/elasticsearch-2-nodes-cluster-%ec%84%a4%ec%b9%98\/","title":{"rendered":"[ElasticSearch] 2 nodes cluster \uc124\uce58"},"content":{"rendered":"<h1>Elasticsearch \uc124\uce58 (2 node cluster)<\/h1>\n<h2>\uc0ac\uc804 \uc900\ube44<\/h2>\n<h3>\uc2dc\uc2a4\ud15c \uc0ac\uc6a9\uc790 \uc0dd\uc131 \ubc0f \ub514\ub809\ud1a0\ub9ac \uc124\uc815<\/h3>\n<h4>\uc2dc\uc2a4\ud15c \uc0ac\uc6a9\uc790 \uc0dd\uc131<\/h4>\n<pre><code class=\"bash\">useradd elastic -g bigdata -u 9200\n<\/code><\/pre>\n<h4>\ub514\ub809\ud1a0\ub9ac \uad8c\ud55c \uc124\uc815<\/h4>\n<p>\ub2e4\uc74c\uacfc \uac19\uc774 \uc5d4\uc9c4, \ub85c\uadf8, \ub370\uc774\ud130\ud30c\uc77c \uacbd\ub85c\ub97c \uad6c\ubd84\ud558\uc5ec \uc124\uce58\ub97c \uc9c4\ud589\ud55c\ub2e4.<\/p>\n<ul>\n<li>elasticsearch \uc5d4\uc9c4 \uacbd\ub85c\n<ul>\n<li>\/app\/elasticsearch<\/li>\n<\/ul>\n<\/li>\n<li>elasticsearch \uc5d4\uc9c4 \ub85c\uadf8 \uacbd\ub85c\n<ul>\n<li>\/logs\/elasticsearch<\/li>\n<\/ul>\n<\/li>\n<li>elasticsearch \ub370\uc774\ud130\ud30c\uc77c (\uc778\ub371\uc2a4) \uacbd\ub85c\n<ul>\n<li>\/data\/elasticsearch<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"shell\">chown elastic:bigdata \/app\/elasticsearch\nchown elastic:bigdata \/logs\/elasticsearch\nchown elastic:bigdata \/data\/elasticsearch\n<\/code><\/pre>\n<h3>JDK \uc124\uce58<\/h3>\n<h4>OpenJDK \uc124\uce58<\/h4>\n<h5>OpenJDK binary \uc900\ube44<\/h5>\n<p>\uc544\ub798 URL\uc5d0\uc11c \uc124\uce58\ud558\uace0\uc790 \ud558\ub294 \ubc84\uc804\uc758 Java Development Kit \uc124\uce58 (jdk-8u181-linux-x64.tar.gz \uae30\uc900\uc73c\ub85c \uc124\uce58 \uc9c4\ud589)<br \/>\nhttp:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html<\/p>\n<h5>JDK \uc124\uce58<\/h5>\n<p>\ub2e4\uc74c \uacbd\ub85c\uc5d0 \ubc14\uc774\ub108\ub9ac\ub97c \uc555\ucd95\ud574\uc81c\ud558\uace0, symbolic link \ub97c \uc0dd\uc131\ud55c \ub4a4 \uc0ac\uc6a9\ud560 \uc608\uc815.<\/p>\n<ul>\n<li>\uc124\uce58 \uacbd\ub85c\n<ul>\n<li>\/app\/jdk\/1.8.0_181<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h6>JDK \ubc14\uc774\ub108\ub9ac \uc555\ucd95 \ud574\uc81c<\/h6>\n<pre><code class=\"shell\">tar -xvzf ~\/jdk-8u181-linux-x64.tar.gz -C \/app\/jdk\/.\nmv \/app\/jdk\/jdk1.8.0_181 \/app\/jdk\/1.8.0_181\n<\/code><\/pre>\n<h6>symbolic link \uc0dd\uc131<\/h6>\n<pre><code class=\"shell\">cd \/app\/jdk\nln -s .\/1.8.0_181\/* .\/.\n<\/code><\/pre>\n<h3>Linux \ucee4\ub110 \uc124\uc815<\/h3>\n<p><code>vi \/etc\/sysctl.conf<\/code> \ud30c\uc77c\uc5d0 \ub2e4\uc74c \ub0b4\uc6a9 \ucd94\uac00<\/p>\n<pre><code class=\"conf\">vm.max_map_count = 262144\n<\/code><\/pre>\n<ul>\n<li><code>max_map_count<\/code><br \/>\n\ud504\ub85c\uc138\uc2a4\uac00 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uba54\ubaa8\ub9ac \ub9f5 \uc601\uc5ed\uc758 \ucd5c\ub300 \uc218<br \/>\n\uae30\ubcf8\uac12\uc740 65530<\/li>\n<\/ul>\n<p><code>sysctl -p<\/code> \uba85\ub839\uc73c\ub85c \ubcc0\uacbd \uc0ac\ud56d \uc801\uc6a9<\/p>\n<h3>Linux ulimit \uc124\uc815<\/h3>\n<p><code>vi \/etc\/security\/limits.conf<\/code> \ud30c\uc77c\uc5d0 \ub2e4\uc74c \ub0b4\uc6a9 \ucd94\uac00<\/p>\n<pre><code class=\"conf\">elastic soft  nofile  65536\nelastic hard  nofile  65536\nelastic soft memlock unlimited\nelastic hard memlock unlimited\n<\/code><\/pre>\n<h2>ElasticSearch \uc124\uce58<\/h2>\n<h3>ElasticSearch binary \uc900\ube44<\/h3>\n<p>\uc544\ub798 URL\uc5d0\uc11c \uc124\uce58\ud558\uace0\uc790 \ud558\ub294 \ubc84\uc804 \uc120\ud0dd \ud6c4 \ub2e4\uc6b4\ub85c\ub4dc (6.2.4 \ubc84\uc804 \uae30\uc900\uc73c\ub85c \uc124\uce58 \uc9c4\ud589)<br \/>\n<a href=\"https:\/\/www.elastic.co\/downloads\/past-releases\">https:\/\/www.elastic.co\/downloads\/past-releases<\/a><\/p>\n<h3>ElasticSearch binary \uc555\ucd95 \ud574\uc81c \ubc0f Symbolic Link \uc0dd\uc131<\/h3>\n<pre><code class=\"bash\">tar -xvzf elasticsearch-6.2.4.tar.gz -C \/app\/elasticsearch\/.\nmv \/app\/elasticsearch\/elasticsearch-6.2.4 \/app\/elasticsearch\/6.2.4\ncd \/app\/elasticsearch\nln -s .\/6.2.4\/* .\/.\n<\/code><\/pre>\n<h3>ElasticSearch \uc124\uc815<\/h3>\n<blockquote><p>\n  node5.big, node6.big \ub450 \uac1c\uc758 \uba64\ubc84 \ub178\ub4dc\ub97c \uac16\ub294 \ud074\ub7ec\uc2a4\ud130\ub97c \uad6c\uc131\ud560 \uc608\uc815\n<\/p><\/blockquote>\n<p><code>vi \/app\/elasticsearch\/config\/elasticsearch.yml<\/code> \ud30c\uc77c\uc5d0 \ub2e4\uc74c \ub0b4\uc6a9 \ucd94\uac00<\/p>\n<h4>@es-node-1<\/h4>\n<pre><code class=\"yml\">cluster.name: elasticsearch-cluster\nnode.name: es-node-1\npath.data: \/data\/elasticsearch\npath.logs: \/logs\/elasticsearch\nnetwork.host: 192.168.179.81\nhttp.port: 9200\ndiscovery.zen.ping.unicast.hosts: [\"node5.big\", \"node6.big\"]\ndiscovery.zen.minimum_master_nodes: 2\n<\/code><\/pre>\n<h4>@es-node-2<\/h4>\n<pre><code class=\"yml\">cluster.name: elasticsearch-cluster\nnode.name: es-node-2\npath.data: \/data\/elasticsearch\npath.logs: \/logs\/elasticsearch\nnetwork.host: 192.168.179.82\nhttp.port: 9200\ndiscovery.zen.ping.unicast.hosts: [\"node5.big\", \"node6.big\"]\ndiscovery.zen.minimum_master_nodes: 2\n<\/code><\/pre>\n<h3>elastic \uc0ac\uc6a9\uc790 profile \uc124\uc815<\/h3>\n<p><code>vi ~\/.bash_profile<\/code> \ud30c\uc77c\uc5d0 \ub2e4\uc74c \ub0b4\uc6a9 \uc218\uc815 \ub610\ub294 \ucd94\uac00.<\/p>\n<pre><code class=\"shell\"># JDK ENV\nexport JAVA_HOME=\/app\/jdk\nexport PATH=$JAVA_HOME\/bin:$PATH\n\n# ELASTICSEARCH ENV\nexport PATH=\/app\/elasticsearch\/bin:$PATH\n#export ES_PATH_CONF=\/path\/to\/my\/config # \uc774 \ubcc0\uc218\ub97c \uc124\uc815\ud558\uba74 \ubc14\uc774\ub108\ub9ac \ub0b4 \uae30\ubcf8 \uacbd\ub85c\uac00 \uc544\ub2cc \ub2e4\ub978 \uacbd\ub85c\uc758 config \ud30c\uc77c\uc744 \ucc38\uc870\ud560 \uc218 \uc788\ub2e4.\n<\/code><\/pre>\n<h2>ElasticSearch \uc2e4\ud589 \ubc0f \uc885\ub8cc<\/h2>\n<h3>\uc2e4\ud589<\/h3>\n<pre><code class=\"shell\">\/app\/elasticsearch\/bin\/elasticsearch -p \/app\/elasticsearch\/elasticsearch_pid &amp;\n<\/code><\/pre>\n<h3>\uc885\ub8cc<\/h3>\n<pre><code class=\"shell\">kill <code>cat \/app\/elasticsearch\/elasticsearch_pid<\/code>\n<\/code><\/pre>\n<h2>ElasticSearch \uc124\uce58 \ud655\uc778<\/h2>\n<pre><code class=\"shell\">$ curl -X GET http:\/\/192.168.179.81:9200\/_cluster\/health?pretty\n{\n  \"cluster_name\" : \"elasticsearch-cluster\",\n  \"status\" : \"green\",\n  \"timed_out\" : false,\n  \"number_of_nodes\" : 2,\n  \"number_of_data_nodes\" : 2,\n  \"active_primary_shards\" : 62,\n  \"active_shards\" : 124,\n  \"relocating_shards\" : 0,\n  \"initializing_shards\" : 0,\n  \"unassigned_shards\" : 0,\n  \"delayed_unassigned_shards\" : 0,\n  \"number_of_pending_tasks\" : 0,\n  \"number_of_in_flight_fetch\" : 0,\n  \"task_max_waiting_in_queue_millis\" : 0,\n  \"active_shards_percent_as_number\" : 100.0\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Elasticsearch \uc124\uce58 (2 node cluster) \uc0ac\uc804 \uc900\ube44 \uc2dc\uc2a4\ud15c \uc0ac\uc6a9\uc790 \uc0dd\uc131 \ubc0f \ub514\ub809\ud1a0\ub9ac \uc124\uc815 \uc2dc\uc2a4\ud15c \uc0ac\uc6a9\uc790 \uc0dd\uc131 useradd elastic -g bigdata -u 9200 \ub514\ub809\ud1a0\ub9ac \uad8c\ud55c \uc124\uc815 \ub2e4\uc74c\uacfc \uac19\uc774 \uc5d4\uc9c4, \ub85c\uadf8, \ub370\uc774\ud130\ud30c\uc77c \uacbd\ub85c\ub97c \uad6c\ubd84\ud558\uc5ec \uc124\uce58\ub97c \uc9c4\ud589\ud55c\ub2e4. elasticsearch \uc5d4\uc9c4 \uacbd\ub85c \/app\/elasticsearch elasticsearch \uc5d4\uc9c4 \ub85c\uadf8 \uacbd\ub85c \/logs\/elasticsearch elasticsearch \ub370\uc774\ud130\ud30c\uc77c (\uc778\ub371\uc2a4) \uacbd\ub85c \/data\/elasticsearch chown elastic:bigdata \/app\/elasticsearch chown elastic:bigdata \/logs\/elasticsearch chown [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[107,25,50],"class_list":["post-302","post","type-post","status-publish","format-standard","hentry","category-elasticsearch","tag-cluster","tag-elasticsearch","tag-50"],"_links":{"self":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/comments?post=302"}],"version-history":[{"count":15,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/302\/revisions"}],"predecessor-version":[{"id":1257,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/posts\/302\/revisions\/1257"}],"wp:attachment":[{"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/media?parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/categories?post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oboki.net\/workspace\/wp-json\/wp\/v2\/tags?post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}