Elasticsearch-head 是一款操作搜索引擎Elasticsearch的插件,能够直观的操作elasticsearch,给开发人员带来极大的方便。下面简单讲解Elasticsearch-head的安装方法。

  1. 安装环境
    1. 建议CentOS7操作系统

    2. JDK(建议1.8或以上)
  2. Elasticsearch(建议Elasticsearch6以上)
  3. head安装
    由于head插件本质上还是一个nodejs的工程,因此需要安装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:PATH:NODE_HOME/bin

source /etc/profile
查看版本验证
[[email protected] bin]$ node -v
v6.10.2
[[email protected] 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
<5>修改配置 elasticsearch-head下Gruntfile.js文件
修改connect配置节点
Elasticsearch-head 安装使用
修改 _site/app.js 修改http://localhost:9200字段到本机ES端口与IP
Elasticsearch-head 安装使用
<6>修改 elasticsearch配置文件
修改elasticsearch.yml文件加入以下内容:

是否支持跨域

http.cors.enabled: true

*表示支持所有域名

http.cors.allow-origin: “*”
Elasticsearch-head 安装使用
<7>启动head插件服务(后台运行)
/elasticsearch-head/node_modules/grunt/bin/grunt server &
Elasticsearch-head 安装使用
<8>查看
如下图说明安装OK
Elasticsearch-head 安装使用

相关文章: