Elasticsearch安裝

1、安裝java環境,按步驟安裝,安裝完成之後,配置環境變量

然後驗證是否安裝成功,在cmd中輸入java -version命令



1.1、安裝Elasticsearch

解壓文件到C盤,路徑中不要又空格和中文字符



進入文件的bin目錄,雙擊運行elasticsearch.bat





然後在瀏覽器中輸入http://localhost:9200/  出現以下界面,表示服務安裝配置成功,接下來安裝head




1.2、安裝Elasticsearch head

   (1) 下載nond.js 網址:https://nodejs.org/en/  我用的是10.1.0




按步驟安裝,安裝完成之後在cmd中驗證以下是否安裝成功,輸入以下命令

echo%NODE_HOME%

node -v



(2) 安裝grunt

 head插件就是通過grunt啓動的。因此需要安裝grunt:cmd進入到node的bin目錄,然後輸入

npm install -g grunt-cli



安裝完成之後輸入 grunt -version 驗證



(3) head配置

從git上下載head源碼 網址 https://github.com/mobz/elasticsearch-head,放到 Elasticsearch的同級目錄

修改head源碼

目錄:head/Gruntfile.js:增加hostname屬性,設置爲*,支持跨機器訪問


修改鏈接地址

目錄:head/_site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";

把localhost 改成你的服務器地址

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.10.10:9200";

修改一下es參數。編輯config/elasticsearch.yml:


# 換個集羣的名字,免得跟別人的集羣混在一起
cluster.name: es-6.2.4
# 換個節點名字
node.name: node-client
# 修改一下ES的監聽地址,這樣別的機器也可以訪問
network.host: 0.0.0.0
# 默認的就好

http.port: 9200

# 增加新的參數,這樣head插件可以訪問es
http.cors.enabled: true

http.cors.allow-origin: "*"

其中,當部署Elasticsearch時是以集羣模式部署的,那麼discovery.zen.ping.unicast.hosts這個屬性纔會需要被配置。


cmd進入head源碼目錄,執行 npm install命令




最後在head目錄中啓動node js



最後在瀏覽器中輸入 最後的url就可以訪問到了, 安裝完畢


將Elasticsearch 做成windows服務

cmd在bin目錄下執行 elasticsearch-service.bat install






 



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章