安装 Head 插件
由于 head 插件本质上还是一个 Node.JS 的工程, 因此需要安装 node, 使用 NPM 来安装依赖的包.
<1 > 安装 Node.JS
下载解压
- wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
- xz -d node-v6.10.2-Linux-x64.tar.xz
- tar xvf node-v6.10.2-Linux-x64.tar
- mv node-v6.10.2-Linux-x64 /usr/local/node
配置并生效
- VIM /etc/profile
- export NODE_HOME=/usr/local/node
- export PATH=$PATH:$NODE_HOME/bin
- source /etc/profile
查看版本验证
- [elsearch@imok bin]$ node -v
- v6.10.2
- [elsearch@imok bin]$ NPM -v
- 3.10.10
- <2 > 下载 head 插件
如果未安装 Git , 则先安装 Git 工具
- yum install -y Git
- Git clone https://github.com/mobz/elasticsearch-head.git
- <3 > 安装 grunt
- cd Elasticsearch-head
- NPM install -g grunt --registry=https://registry.npm.taobao.org
- <4 > 安装插件
- NPM install
在 Elasticsearch-head 目录下 node_modules/grunt 下如果没有 grunt 二进制程序, 需要执行:
- NPM install grunt --save
- <5 > 修改配置 Elasticsearch-head 下 Gruntfile.JS 文件
修改 connect 配置节点
修改 _site/App.JS 修改 http://localhost:9200 字段到本机 ES 端口与 IP
<6 > 修改 Elasticsearch 配置文件
修改 Elasticsearch.YAML 文件加入以下内容:
- # 是否支持跨域
- http.cors.enabled: true
- # * 表示支持所有域名
- http.cors.allow-origin: "*"
- <7>
- 启动 head 插件服务 (后台运行) /Elasticsearch-head/node_modules/grunt/bin/grunt server
- &
<8 > 查看
如下图说明安装 OK
来源: http://www.bubuko.com/infodetail-2975583.html