Elasticsearch是一個分布式、RESTful風格的搜索和數據分析引擎,能夠快速地存儲、搜索和分析大量數據。它廣泛應用于日志分析、全文搜索、實時數據分析等場景。本文將詳細介紹如何在Windows環境下安裝和配置Elasticsearch 7.9集群。
在開始安裝之前,確保你的Windows系統滿足以下要求:
Elasticsearch依賴于Java運行環境,因此需要先安裝Java。
Path,點擊“編輯”。C:\Program Files\Java\jdk-11.0.11\bin。java -version,確保顯示Java 11或更高版本。C:\elasticsearch-7.9.0。
C:\elasticsearch-7.9.0
├── bin
├── config
├── data
├── logs
├── modules
├── plugins
└── ...
C:\elasticsearch-7.9.0\config\elasticsearch.yml文件。my-cluster。node-1。C:\elasticsearch-7.9.0\data。C:\elasticsearch-7.9.0\logs。0.0.0.0。9200。["127.0.0.1"]。["node-1"]。bin目錄:
cd C:\elasticsearch-7.9.0\bin
elasticsearch.bat
http://localhost:9200,如果看到類似以下內容,說明Elasticsearch已成功啟動:
{
"name" : "node-1",
"cluster_name" : "my-cluster",
"cluster_uuid" : "abc123",
"version" : {
"number" : "7.9.0",
"build_flavor" : "default",
"build_type" : "zip",
"build_hash" : "abc123",
"build_date" : "2020-10-01T00:00:00.000Z",
"build_snapshot" : false,
"lucene_version" : "8.6.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
C:\elasticsearch-7.9.0-node2。C:\elasticsearch-7.9.0-node2\config\elasticsearch.yml文件:
node-2。9201。["127.0.0.1"]。["node-1", "node-2"]。確保所有節點的cluster.name配置相同,例如my-cluster。
確保所有節點的network.host配置為0.0.0.0,以便節點之間可以互相通信。
discovery.seed_hosts中列出所有節點的IP地址或主機名,例如["127.0.0.1"]。cluster.initial_master_nodes中列出所有初始主節點的名稱,例如["node-1", "node-2"]。bin目錄:
cd C:\elasticsearch-7.9.0\bin
elasticsearch.bat
bin目錄:
cd C:\elasticsearch-7.9.0-node2\bin
elasticsearch.bat
http://localhost:9200/_cluster/health,查看集群健康狀態:
{
"cluster_name" : "my-cluster",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
status為green,說明集群健康。C:\elasticsearch-7.9.0\config\jvm.options文件,調整-Xms和-Xmx參數,例如:
-Xms1g
-Xmx1g
C:\elasticsearch-7.9.0\config\elasticsearch.yml文件中的http.port或transport.port,確保端口未被占用。discovery.seed_hosts和cluster.initial_master_nodes配置,確保所有節點的配置一致。通過本文的步驟,你應該已經成功在Windows環境下安裝和配置了Elasticsearch 7.9集群。Elasticsearch的強大功能可以幫助你快速處理和分析大量數據,適用于各種應用場景。如果在安裝和配置過程中遇到問題,可以參考常見問題與解決方案部分,或者查閱Elasticsearch官方文檔獲取更多幫助。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。