針對叢集配置 Elasticsearch
本主題說明如何為叢集環境配置 Elasticsearch 。
若要為叢集環境配置 Elasticsearch ,請執行下列動作:
- 設定 Elasticsearch 服務之後,請瀏覽至 Elasticsearch安裝所在的資料夾。
- 編輯
elasticsearch.yml檔案中的下列內容,該檔案位於 elasticsearch-x.x.x/config/ 資料夾中:內容名稱 價值 註解 cluster.initial_master_nodes IP 位址:TransportPort 陣列格式之起始主要節點資訊的 IP 位址:TransportPort 。 例如, ["192.168.56.1:9300"] cluster.name es-cluster 依預設,應用程式會使用 cluster.name=es-cluster。重要事項: 如果您修改cluster.name內容的值,則還必須更新 env_settings.ini 檔案中的叢集名稱。discovery.seed.hosts IP 位址:TransportPort 本身節點及陣列格式之其他節點的 IP 位址:TransportPort 。 例如, discovery.seed_hosts: ["192.168.56.1:9300", "192.168.56.1:9310"]http.port HTTP 埠 HTTP 埠 "http.port"。 indices.query.bool.max_clause_count 10000 Lucene BooleanQuery 可以包含的子句數目上限。 network.host 主機 IP 位址 主機的 IP 位址,可讓 Elasticsearch 服務從網路中的其他工作站存取。 node.master true 將現行節點設為主要節點。 依預設,此值為 true
。node.name 節點名稱 節點的敘述性名稱。 path.data <Elasticsearch_Parent _Folder>\data Elasticsearch 儲存資料的檔案路徑。 - Windows- D:\elasticsearch-x.x.x\data
- Linux® - /tmp/elasticsearch-x.x.x/data
path.logs <Elasticsearch_Parent _Folder>\logs 產生 Elasticsearch 日誌的檔案路徑。 - Windows- D:\elasticsearch-x.x.x\logs
- Linux - /tmp/elasticsearch-x.x.x/logs
transport.port TCP 埠 TCP 埠。 xpack.ml.enabled false Elasticsearch使用的機器學習引擎。 依預設,此值為 false
。 - 重新啟動 Elasticsearch 服務,讓變更生效。
- 驗證搜尋服務正在透過下列 URL 執行: <http://localhost:9200>。 URL 應該會傳回 JSON 回應,且 cluster_name 的值應該符合指定給
elasticsearch.yml檔中 cluster.name 內容的值。