安裝步驟如下:
一、安裝nodejs
head插件是nodejs實現的,所以必須先安裝Nodejs
安裝步驟:https://blog.csdn.net/zhanyu1/article/details/88082758
二、安裝git
由於要使用git方式下載head插件,因此需要先安裝git
安裝步驟:https://blog.csdn.net/zhanyu1/article/details/88083041
三、下載並安裝head插件
進入/usr/local目錄下
[root@localhost ~]# cd /usr/local
執行以下步驟:
- git clone git://github.com/mobz/elasticsearch-head.git
- cd elasticsearch-head
- npm install
- npm run start
- open http://localhost:9100/
(該步驟可以在 https://github.com/mobz/elasticsearch-head 官網中看到)
上述步驟中,npm install這個步驟執行太慢,需要按照以下方法改造下npm鏡像地址
1、npm get registry --顯示當前的鏡像網址
[root@localhost elasticsearch-head]# npm get registry
https://registry.npmjs.org/
2、修改npm鏡像地址
[root@localhost elasticsearch-head]# npm config set registry http://registry.npm.taobao.org
3、再次運行npm get registry,則npm鏡像地址已改變
[root@localhost elasticsearch-head]# npm get registry
http://registry.npm.taobao.org/
四、進入elasticsearch配置文件配置head插件
[root@localhost ~]# cd /home/es/elasticsearch-6.3.0/config/
打開 elasticsearch.yml,文件最後加上以下內容
http.cors.enabled: true
http.cors.allow-origin: “*”
五、安裝測試
1)啓動elasticsearch
[elastic@localhost root]$ sh /home/es/elasticsearch-6.3.0/bin/elasticsearch -d
2)執行npm run start 啓動插件,出現以下情況,說明啓動成功
[elastic@localhost elasticsearch-head]$ npm run start
3)瀏覽器輸入 http://192.168.1.102:9100/
紅色框輸入 http://192.168.1.102:9200/ 點擊連接,出現以下情況,則說明整個配置過程正常完成。