elasticsearch及head插件安装

本文为博主原创文章,地址:http://blog.csdn.net/napoay,转载请留言.

一、下载安装包

下载Elasticsearch 5.1.1

下载地址:https://www.elastic.co/downloads/elasticsearch

zip和tar格式是各种系统都通用的,解压之后启动Elasticsearch即可。

下载elasticsearch-head

下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。

二、安装node、npm、grunt

node下载地址nodejs.org/

$ node -v
v6.8.1

npm下载地址https://www.npmjs.com

$ npm -v
3.10.8

使用npm安装grunt:

npm install –g grunt–cli

三、npm 安装依赖

到elasticsearch-head-master目录下,运行命令:

npm install

如果速度较慢或者安装失败,可以使用国内镜像:

 npm install -g cnpm --registry=https://registry.npm.taobao.org

四、修改Elasticsearch配置文件

编辑elasticsearch-5.1.1/config/elasticsearch.yml,加入以下内容:

http.cors.enabled: true
http.cors.allow-origin: "*"

五、修改Gruntfile.js

打开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

在elasticsearch-head-master/目录下,运行启动命令:

grunt server

截图如下: 
这里写图片描述

访问9100端口: 
这里写图片描述

七、后台启动elasticsearch-head

后台启动grunt server命令;

nohup grunt server &exit

如果想关闭head插件,使用Linux查找进程命令:

ps aux|grep head

结束进程:

kill 进程号

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_27231343/article/details/73330280