安裝git
yum install git
下載head
git clone?https://github.com/mobz/elasticsearch-head.git
安裝nodejs
通過下載包安裝:
nodejs下載地址:http://nodejs.cn/download/
上傳到 /usr/local/nodejs 目錄下,然后解壓
通過建立軟連接變?yōu)槿?/p>
[root@Centos-51 nodejs]# ln -s /usr/local/nodejs/node-v12.13.1-linux-x64/bin/npm /usr/local/bin/
[root@Centos-51 nodejs]# ln -s /usr/local/nodejs/node-v12.13.1-linux-x64/bin/node /usr/local/bin/
安裝成功顯示如下
[root@Centos-51 nodejs]# node -v
v12.13.1
安裝head
elasticsearch-head目錄下執(zhí)行:
npm install
配置跨域
修改elasticsearch.yml扭倾,增加:
http.cors.enabled: true
http.cors.allow-origin: "*"
修改連接地址
打開elasticsearch-head/_site/app.js文件拍谐,搜索localhost,修改ip
啟動head插件
在elasticsearch-head目錄下執(zhí)行:
[root@Centos-51 elasticsearch-head]# npm run start &
> elasticsearch-head@0.0.0 start /usr/local/elasticsearch-head
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on?http://192.168.0.51:9100
按ctrl + c 命令回到終端怒竿,然后exit,退出終端扩氢,否則終端窗口關(guān)閉后耕驰,就會停止服務
瀏覽器訪問http://192.168.0.51:9100即可
停止node服務
[root@Centos-51 elasticsearch-head]#lsof -i:9100
COMMAND? PID USER? FD? TYPE? DEVICE SIZE/OFF NODE NAME
grunt? 9225 root? 20u? IPv4 30826791? ? ? 0t0? TCP Centos-51:jetdirect (LISTEN)
[root@Centos-51 elasticsearch-head]# kill -9 9225
[root@Centos-51 elasticsearch-head]#