Elasticsearch-5.5.0安裝head插件

Tips:環(huán)境

windows用戶建議安裝個 TortoiseGit客戶端

下載Elasticsearch 5.5.0 ?? https://www.elastic.co/downloads/elasticsearch

  • ziptar格式是各種系統(tǒng)都通用的,解壓之后啟動Elasticsearch即可。

1、npm安裝grunt

$ npm install -g grunt-cli
$ grunt -version

注意這里安裝的時候路徑一定要切換到grunt-cli文件夾下面

這些是Grunt file.js中引用的,分別下載

$ npm install grunt-contrib-copy
$ npm install grunt-contrib-concat
$ npm install grunt-contrib-uglify
$ npm install grunt-css

2、下載官方源碼

官方源碼 ?? https://github.com/mobz/elasticsearch-head

$ git clone git://github.com/mobz/elasticsearch-head.git

3、修改head源碼

由于head的代碼還是2.6版本的,直接執(zhí)行有很多限制,比如無法跨機器訪問。因此需要用戶修改兩個地方:

目錄:head/Gruntfile.js
增加hostname屬性,設置為*

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

3.1、修改連接地址:

目錄:head/_site/app.js

修改head的連接地址:
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://10.10.10.10:9200";

4、運行Elasticsearch-head

修改elasticsearch的參數(shù)

修改一下es使用的參數(shù)。編輯config/elasticsearch.yml

注意,設置參數(shù)的時候:后面要有空格!

# 換個集群的名字,免得跟別人的集群混在一起
cluster.name: es-5.0-test

# 換個節(jié)點名字
node.name: node-101

# 修改一下ES的監(jiān)聽地址,這樣別的機器也可以訪問
network.host: 0.0.0.0

# 默認的就好
http.port: 9200

# 增加新的參數(shù),這樣head插件可以訪問es
http.cors.enabled: true
http.cors.allow-origin: "*"

開啟ES-5.5.0ElasticSearch-5.0.0\bin\elasticsearch.bat

然后在head源碼目錄中,執(zhí)行npm install進行安裝:

$ npm install
  • 初次運行安裝可能會報警告或錯誤??梢灾匦逻\行一次npm install

最后,使用grunt命令在head源碼目錄下啟動:

$ grunt server

效果如圖:


訪問 http://localhost:9100

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容