1,elasticsearch-head的安装
1,head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。
<1>安装Node.js
下载解压
[root@centos7 ~]# wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
[root@centos7 ~]# tar xf node-v6.10.2-linux-x64.tar
[root@centos7 ~]# mv node-v6.10.2-linux-x64 /usr/local/node
配置并生效
[root@centos7 ~]# vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
[root@centos7 ~]# source /etc/profile
查看版本验证
[root@centos7 ~]# node -v
v6.10.2
[root@centos7 ~]# npm -v
3.10.10
<2>下载head插件
[root@centos7 ~]# git clone https://github.com/mobz/elasticsearch-head.git
<3>安装grunt(grunt是基于Node.js的项目构建工具,可以进行打包压缩、测试、执行等等工作,elasticsearch-head插件就是通过grunt启动的)
[root@centos7 ~]#
[root@centos7 ~]# npm install -g grunt-cli
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
/usr/local/node/bin/grunt -> /usr/local/node/lib/node_modules/grunt-cli/bin/grunt
/usr/local/node/lib
└── grunt-cli@1.3.2
[root@centos7 ~]#
<4>安装插件
[root@centos7 ~]# cd /root/elasticsearch-head-master
[root@centos7 ~]# npm install
<5>修改配置 elasticsearch-head下Gruntfile.js文件
修改elasticsearch-head-master下Gruntfile.js配置文件,添加hostname: '192.168.0.11',
修改 _site/app.js 修改http://localhost:9200字段到本机ES端口与IP
<6>修改elasticsearch.yml文件加入以下内容:
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
<7>启动head插件服务(后台运行)
[root@centos7 ~]# /root/elasticsearch-head-master/node_modules/grunt/bin/grunt server &
访问elasearch-head URL:
http://192.168.0.11:9100/


浙公网安备 33010602011771号