November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7

ELASTICSEARCH: LISTEN ALL NETWORK INTERFACES ON CENTOS 7

 

 

y default elasticsearch listens to localhost.

# netstat -na|grep LISTEN |grep 9200
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN
tcp6       0      0 ::1:9200                :::*                    LISTEN       

If you want to access over the network you need to edit network.host parameter /etc/elasticsearch/elasticsearch.yml  file

———————————- Network ———————————–
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
http.port: 9200
#         

Comment out network.host and type your IP address or type 0.0.0.0 to listen all interfaces

 network.host: 0.0.0.0

and restart elasticsearch

# systemctl restart elasticsearch 

 

# netstat -na|grep LISTEN |grep 9200
tcp6       0      0 :::9200                 :::*                    LISTEN

curl http://192.168.1.112:9200
{
  “name” : “Phantom Eagle”,
  “cluster_name” : “elasticsearch”,
  “cluster_uuid” : “k9tOhsoyTrOnvR-QpUpHxA”,
  “version” : {
    “number” : “2.4.1”,
    “build_hash” : “c67dc32e24162035d18d6fe1e952c4cbcbe79d16”,
    “build_timestamp” : “2016-09-27T18:57:55Z”,
    “build_snapshot” : false,
    “lucene_version” : “5.5.2”
  },
  “tagline” : “You Know, for Search”
}          

In this case, your elasticsearch will be accessible from network without any restriction. You should enable IP based filtering/firewall or user authentication.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>