elasticsearch5.x 集群管理工具head插件安装、nginx配置外网访问

来源:互联网 发布:matlab find(矩阵) 编辑:程序博客网 时间:2024/06/06 01:07

一、下载安装包

下载Elasticsearch 5.x

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

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

下载elasticsearch-head

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

二、安装node、npm、grunt

node下载地址nodejs.org/  (node安装可参考文章http://blog.csdn.net/kelin_liu/article/details/72729050)

$ node -vv6.10.3

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

$ npm -v3.10.10

使用npm安装grunt:

npm install –g grunt–cli

三、npm 安装依赖

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

npm install

四、修改Elasticsearch配置文件

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

http.cors.enabled: truehttp.cors.allow-origin: "*"
启动elasticsearch:
$ elasticsearch-5.x/bin/elasticsearch -d

五、修改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

访问 http://127.0.0.1:9100/



此url供内网访问.所以我们利用nginx 配置外网访问head


七、配置nginx



域名替换成自己的。为了安全,这里加了nginx 的auth_basic认证。

重启nginx,访问 http://elastic.liukelin.top/head/


完成!

5.x后的 elasticsearch 自带插件不包含/_plugin/head/,而是使用node另起服务
如果是2.x elasticsearch  直接 $elasticsearch/bin/plugin -install mobz/elasticsearch-head 安装插件,运行http://localhost:9200/_plugin/head/ 即可,nginx配置也只需配置:
location / {                proxy_pass      http://127.0.0.1:9200/;                include         proxy_params;        }

阅读全文
0 0
原创粉丝点击