Elasticsearch 외부접속 허용

Posted by Albert 802Day 16Hour 50Min 29Sec ago [2023-02-07]

처음 설치후 localhost:9200에서는 잘 확인되지만 

다른 pc에서 접속시도시 페이지 접속되지않는다.

외부접속 허용하면 되는데 방법은 아래와같다.


1. sudo vi /etc/elasticsearch/elasticsearch.yml

/9200 으로 아래 내용을 찾는다

====================================

'network.host: 192.168.0.1

'network.host: localhost

network.host: 0.0.0.0

'

' By default Elasticsearch listens for HTTP traffic on the first free port it

' finds starting at 9200. Set a specific HTTP port here:

'

http.port: 9200

'

' For more information, consult the network module documentation.

'


추가로 아래 cluster.initial_master_nodes: ["node-1", "node-2"] 주석해제

' --------------------------------- Discovery ----------------------------------
'
' Pass an initial list of hosts to perform discovery when this node is started:
' The default list of hosts is ["127.0.0.1", "[::1]"]
'
'discovery.seed_hosts: ["host1", "host2"]
'
' Bootstrap the cluster using an initial set of master-eligible nodes:
'
cluster.initial_master_nodes: ["node-1", "node-2"]
'
' For more information, consult the discovery and cluster formation module documentation.
'

이렇게 하여 총3곳 수정하고 elasticsearch 서비스 재시작하면된다.

1.network.host: 0.0.0.0, 2.http.port: 9200 3.cluster.initial_master_nodes: ["node-1", "node-2"] 

sudo systemctl stop elasticsearch

sudo systemctl start elasticsearch






LIST

Copyright © 2014 visionboy.me All Right Reserved.