elasticsearch-head 安裝使用

需要安裝node

 

5.0以上,elasticsearch-head 不能放在elasticsearch的 plugins、modules 目錄下,否則elasticsearch啓動會報錯

 

跨域

1、vim /elasticsearch-head/Gruntfile.js

添加 connect : server:options:{port base keepalive }中添加

hostname:'*'

爲什麼需要修改配置文件: head插件連接elasticsearch需要注意的點: 因爲head插件是一個獨立進程,啓動後是一個獨立的服務器外加端口,比如我的虛擬機ip地址:http://192.168.0.111:9100/ 而elasticsearch啓動後也是一個獨立的進程,ip地址:http://192.168.0.111:9200/ 這樣兩個獨立進程,雖然服務器ip地址相同,但是端口不同,此時會發生跨域的情況。。 於是官方給出這樣一段話,我們在對elasticsearch啓動的時候追加兩個配置文件屬性即可防止跨域。

 

2、elasticsearch.yml 添加

http.cors.enabled: true

http.cors.allow-origin: "*“

3、域名

elasticsearch-head/_site/app.js

將

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

把localhost修改爲你es的服務器地址。

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://[對應elasticsearch.yml 中配置的ip]:9200";

 

當前目錄下 依次

  • npm install
  • npm run start

 

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