{"id":7714,"date":"2018-09-18T22:05:10","date_gmt":"2018-09-18T14:05:10","guid":{"rendered":"http:\/\/rmohan.com\/?p=7714"},"modified":"2018-09-18T22:05:10","modified_gmt":"2018-09-18T14:05:10","slug":"elasticsearch-listen-all-network-interfaces-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7714","title":{"rendered":"ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7"},"content":{"rendered":"<h1 class=\"entry-title\">ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS\u00a07<\/h1>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>y default elasticsearch listens to localhost.<\/p>\n<p><strong><em># netstat -na|grep LISTEN |grep 9200<\/em><\/strong><br \/>\n<em>tcp6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 127.0.0.1:9200\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN<\/em><br \/>\n<em>tcp6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 ::1:9200\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/em><\/p>\n<p>If you want to access over the network you need to edit\u00a0<span class=\"skimlinks-unlinked\">network.host<\/span>\u00a0parameter\u00a0<em><strong>\/etc\/elasticsearch\/<span class=\"skimlinks-unlinked\">elasticsearch.yml<\/span>\u00a0<\/strong><\/em>\u00a0file<\/p>\n<p><em>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014- Network \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/em><br \/>\n<em>#<\/em><br \/>\n<em># Set the bind address to a specific IP (IPv4 or IPv6):<\/em><br \/>\n<em>#<\/em><br \/>\n<strong><em>#\u00a0<span class=\"skimlinks-unlinked\">network.host<\/span>: 192.168.0.1<\/em><\/strong><br \/>\n<em>#<\/em><br \/>\n<em># Set a custom port for HTTP:<\/em><br \/>\n<em>#<\/em><br \/>\n<em>#\u00a0<span class=\"skimlinks-unlinked\">http.port<\/span>: 9200<\/em><br \/>\n<em>#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/em><\/p>\n<p>Comment out\u00a0<span class=\"skimlinks-unlinked\">network.host<\/span>\u00a0and type your IP address or type 0.0.0.0 to listen all interfaces<\/p>\n<p><strong><em>\u00a0<span class=\"skimlinks-unlinked\">network.host<\/span>: 0.0.0.0<br \/>\n<\/em><\/strong><\/p>\n<p>and restart elasticsearch<\/p>\n<p><em><strong>#\u00a0systemctl restart elasticsearch<\/strong>\u00a0<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><em><strong># netstat -na|grep LISTEN |grep 9200<\/strong><\/em><br \/>\n<em>tcp6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 :::9200\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :::*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN<\/em><\/p>\n<p><strong>#\u00a0<em>curl\u00a0<a href=\"http:\/\/192.168.1.112:9200\/\" rel=\"nofollow\">http:\/\/192.168.1.112:9200<\/a><\/em><\/strong><br \/>\n<em>{<\/em><br \/>\n<em>\u00a0 \u201cname\u201d : \u201cPhantom Eagle\u201d,<\/em><br \/>\n<em>\u00a0 \u201ccluster_name\u201d : \u201celasticsearch\u201d,<\/em><br \/>\n<em>\u00a0 \u201ccluster_uuid\u201d : \u201ck9tOhsoyTrOnvR-QpUpHxA\u201d,<\/em><br \/>\n<em>\u00a0 \u201cversion\u201d : {<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 \u201cnumber\u201d : \u201c2.4.1\u201d,<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 \u201cbuild_hash\u201d : \u201cc67dc32e24162035d18d6fe1e952c4cbcbe79d16\u201d,<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 \u201cbuild_timestamp\u201d : \u201c2016-09-27T18:57:55Z\u201d,<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 \u201cbuild_snapshot\u201d : false,<\/em><br \/>\n<em>\u00a0\u00a0\u00a0 \u201clucene_version\u201d : \u201c5.5.2\u201d<\/em><br \/>\n<em>\u00a0 },<\/em><br \/>\n<em>\u00a0 \u201ctagline\u201d : \u201cYou Know, for Search\u201d<\/em><br \/>\n<em>}\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/em><\/p>\n<p>In this case, your elasticsearch will be accessible from network without any restriction. You should enable IP based filtering\/firewall or user authentication.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7 <\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>y default elasticsearch listens to localhost.<\/p>\n<p># netstat -na|grep LISTEN |grep 9200 tcp6 0 0 127.0.0.1:9200 :::* LISTEN tcp6 0 0 ::1:9200 :::* LISTEN <\/p>\n<p>If you want to access over the network you need to edit network.host parameter \/etc\/elasticsearch\/elasticsearch.yml file<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014- Network \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013 # [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7714"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7714"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7714\/revisions"}],"predecessor-version":[{"id":7715,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7714\/revisions\/7715"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}