下载Elasticsearch 5.1.1node
下载地址:https://www.elastic.co/downloads/elasticsearchlinux
zip和tar格式是各类系统都通用的,解压以后启动Elasticsearch便可。git
下载elasticsearch-headgithub
下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。npm
node下载地址nodejs.org/cors
$ node -v v6.8.1
npm下载地址https://www.npmjs.comelasticsearch
$ npm -v 3.10.8
使用npm安装grunt:grunt
npm install –g grunt–cli
到elasticsearch-head-master目录下,运行命令:.net
npm install
若是速度较慢或者安装失败,能够使用国内镜像:插件
npm install -g cnpm --registry=https://registry.npm.taobao.org
编辑elasticsearch-5.1.1/config/elasticsearch.yml,加入如下内容:
http.cors.enabled: true http.cors.allow-origin: "*"
打开elasticsearch-head-master/Gruntfile.js,找到下面connect属性,新增hostname: ‘0.0.0.0’:
connect: { server: { options: { hostname: '0.0.0.0', port: 9100, base: '.', keepalive: true } } }
在elasticsearch-head-master/目录下,运行启动命令:
grunt server
截图以下:
访问9100端口:
后台启动grunt server命令;
nohup grunt server &exit
若是想关闭head插件,使用Linux查找进程命令:
ps aux|grep head
结束进程:
kill 进程号