天天看點

window10下安裝Elasticsearch(es)和IK分詞器

1 安裝Elasticsearch 7.x 

1.1 下載下傳位址

 https://www.elastic.co/cn/downloads/elasticsearch

window10下安裝Elasticsearch(es)和IK分詞器

1.2 下載下傳後解壓的目錄結構

Elasticsearch 7.6.2 目錄結構如下:

window10下安裝Elasticsearch(es)和IK分詞器

目錄檔案作用:

  • bin :腳本檔案,包括 ES 啟動 & 安裝插件等等
  • config : elasticsearch.yml(ES 配置檔案)、jvm.options(JVM 配置檔案)、日志配置檔案等等
  • JDK : 内置的 JDK,JAVA_VERSION="13.0.2"
  • lib : 類庫
  • logs : 日志檔案
  • modules : ES 所有子產品,包括 X-pack 等
  • plugins : ES 已經安裝的插件。預設沒有插件
  • data : ES 啟動的時候,會有該目錄,用來存儲文檔資料。該目錄可以設定

具體看看關鍵的 jvm.options JVM 配置檔案,預設配置如下:

-Xms1g
-Xmx1g
           

ES 預設安裝後設定的堆記憶體是 1 GB,對于任何業務來說這個設定肯定是少了。那設定多少?

推薦:如果足夠的記憶體,也盡量不要 超過 32 GB。即每個節點記憶體配置設定不超過 32 GB。 因為它浪費了記憶體,降低了 CPU 的性能,還要讓 GC 應對大記憶體。如果你想保證其安全可靠,設定堆記憶體為 31 GB 是一個安全的選擇。

上述推薦,理由來自《堆記憶體:大小和交換編輯》:https://www.elastic.co/guide/cn/elasticsearch/guide/current/heap-sizing.html

部分參考:https://www.cnblogs.com/Alandre/p/11386178.html

1.3 啟動es

進入到es的bin目錄下輕按兩下"elasticsearch.bat"

啟動時會提示"future versions of Elasticsearch will require Java 11; your Java version from [D:\javasoft\jdk8\jre] does not meet this requirement"我的jdk是1.8,是以會提示,不用管它。

啟動成功後會提示:"started"

轉載請标明連結:https://blog.csdn.net/wabiaozia/article/details/105603861

1.4 驗證啟動成功與否

在浏覽器中輸入,輸入 http://localhost:9200/ 會傳回

window10下安裝Elasticsearch(es)和IK分詞器

通過 http://localhost:9200/_cat/nodes?v 位址,可以看到目前節點資訊

window10下安裝Elasticsearch(es)和IK分詞器

一切順利~~~~~~~~~

2 安裝IK分詞器

2.1 介紹一個傻瓜式安裝方式,不用再下載下傳再打包再解壓的。

進入es的bin下,打開指令黑視窗執行指令即可。

elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip
           

2.2 注意可能會報錯:

錯誤1:

elasticsearch-plugin : 無法将“elasticsearch-plugin”項識别為 cmdlet、函數、腳本檔案或可運作程式的名稱。請檢查名稱的拼

寫。

這時在最前面加上 ".\"即可。

.\elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.0/elasticsearch-analysis-ik-7.6.2.zip
           

轉載請标明連結:https://blog.csdn.net/wabiaozia/article/details/105603861

錯誤2:

Exception in thread "main" java.io.FileNotFoundException: https://github.com/medcl/elasticsearch-analysis-ik/releases/download/。。。。。

window10下安裝Elasticsearch(es)和IK分詞器

把這兩個版本保持一緻即可。

最後會确認install即可;

window10下安裝Elasticsearch(es)和IK分詞器

3 最後驗證:

重新啟動es,不報錯就說明成功了。一切順利~~~

繼續閱讀