安装git
yum install git
下载head
git clone https://github.com/mobz/elasticsearch-head.git
安装nodejs
通过下载包安装:
nodejs下载地址:http://nodejs.cn/download/
上传到 /usr/local/nodejs 目录下,然后解压
通过建立软连接变为全局
[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目录下执行:
npm install
配置跨域
修改elasticsearch.yml,增加:
http.cors.enabled: true
http.cors.allow-origin: "*"
修改连接地址
打开elasticsearch-head/_site/app.js文件,搜索localhost,修改ip
启动head插件
在elasticsearch-head目录下执行:
[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,退出终端,否则终端窗口关闭后,就会停止服务
浏览器访问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]#
网友评论