1. 程式人生 > >一. Windows安裝Elastic Search和Head插件

一. Windows安裝Elastic Search和Head插件

onf new yml 安裝包 請求 環境 簡單 -s mil

一.安裝包下載

  • Node: https://nodejs.org/en/download/

  • ES: https://www.elastic.co/downloads/elasticsearch

  • Head: https://github.com/mobz/elasticsearch-head


二.安裝Node

安裝Node是為了後續安裝Head插件,Node安裝比較簡單,需要配置環境變量


三.安裝ES

1.將ES安裝包解壓到指定目錄

2.修改config下的elasticsearch.yml

註意:在elasticsearch.yml中必須加入http.cors.enabled: true和http.cors.allow-origin: "*",不然Head連接不上ES,請求跨域問題


四.安裝Head插件

1.將Head插件解壓後放到ES跟目錄下,5.x之前版本放在plugin下

2.修改_site/app.js

    this.prefs = services.Preferences.instance();
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
if( this.base_uri.charAt( this.base_uri.length - 1 ) !== "/" ) {
// XHR request fails if the URL is not ending with a "/"
this.base_uri += "/";
}


3.修改Gruntfile.js

    connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}

4.執行命令

進入到head根目錄

npm install

npm run start

五.測試

1.先npm run start啟動Head:127.0.0.1:9100

2.在直接運行elasticsearch.bat啟動ES: 127.0.0.1:9200


一. Windows安裝Elastic Search和Head插件