1. 程式人生 > 實用技巧 >Elasticsearch7 配置叢集時配置檔案(解決elasticsearch head無法連線elasticsearch問題)

Elasticsearch7 配置叢集時配置檔案(解決elasticsearch head無法連線elasticsearch問題)

1.主節點配置檔案

[root@es_master ~]# cat  /home/wx/elasticsearch-7.9.0/config/elasticsearch.yml
cluster.name: ELK-Cluster
node.name: elk-node1
# 開啟跨域訪問支援,預設為false(不開啟elasticsearch head外掛無法連結elasticsearch)
http.cors.enabled: true
# 跨域訪問允許的域名地址(不開啟elasticsearch head外掛無法連結elasticsearch)
http.cors.allow-origin: "*"
# 通過為 cluster.initial_master_nodes 引數設定符合主節點條件的節點的 IP 地址來引導啟動叢集 cluster.initial_master_nodes: ["elk-node1"] path.data: /home/wx/elasticsearch-7.9.0/data path.logs: /home/wx/elasticsearch-7.9.0/logs bootstrap.memory_lock: true network.host: 0.0.0.0 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.56.30","
192.168.56.31"]

2.從節點配置檔案

[root@ex_node ~]# cat  /home/wx/elasticsearch-7.9.0/config/elasticsearch.yml
cluster.name: ELK-Cluster
node.name: elk-node2
cluster.initial_master_nodes: ["elk-node1"]
path.data: /home/wx/elasticsearch-7.9.0/data
path.logs: /home/wx/elasticsearch-7.9.0/logs
bootstrap.memory_lock: true
network.host: 
0.0.0.0 http.port: 9200 discovery.zen.ping.unicast.hosts: ["192.168.56.30","192.168.56.31"]