在5.0版本中不支持直接安装head插件,需要启动一个服务。

由于head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。(npm可以理解为maven)

1、安装Node.js

官网nodejs,https://nodejs.org/en/download/

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:$NODE_HOME/bin source /etc/profile # node –v
v6.10.2 # npm –v
3.10.10

说明:前面讲了,npm相当于是maven,但npm究竟在哪?其实npm已经在Node.js安装的时候顺带装好了。

2、下载插件包

如果找不到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、安装Head插件

npm install

在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行:

cd elasticsearch-head
npm install grunt --save

5、修改配置

修改elasticsearch-head下Gruntfile.js文件,默认监听在127.0.0.1下9200端口:

hostname: ‘192.168.33.50’,

修改 _site/app.js

修改http://localhost:9200字段到本机ES端口与IP:

21行:http://192.168.33.50:9200

6、修改Elasticsearch配置

修改elasticsearch.yml文件加入以下内容:

# 是否支持跨域
http.cors.enabled: true # *表示支持所有域名
http.cors.allow-origin: "*"

7、启动服务

/elasticsearch-head/node_modules/grunt/bin/grunt server (后台运行 + &)

浏览器访问 http://192.168.33.50:9100/

附:

wiki上的解释是 Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources ,即跨域访问。

这个字段默认为false,在Elasticsearch安装集群之外的一台机上用Sense、Head等监控插件访问Elasticsearch是不允许的。这个字段最早可以追溯到1.4.x版本,而非5.x特有。

具体这个http.cors.x字段还有哪些用途和用法,见下表:

http.cors.enabled

是否支持跨域,默认为false

http.cors.allow-origin

当设置允许跨域,默认为*,表示支持所有域名,如果我们只是允许某些网站能访问,那么可以使用正则表达式。比如只允许本地地址。 /https?:\/\/localhost(:[0-9]+)?/

http.cors.max-age

浏览器发送一个“预检”OPTIONS请求,以确定CORS设置。最大年龄定义多久的结果应该缓存。默认为1728000(20天)

http.cors.allow-methods

允许跨域的请求方式,默认OPTIONS,HEAD,GET,POST,PUT,DELETE

http.cors.allow-headers

跨域允许设置的头信息,默认为X-Requested-With,Content-Type,Content-Length

http.cors.allow-credentials

是否返回设置的跨域Access-Control-Allow-Credentials头,如果设置为true,那么会返回给客户端。

Elasticsearch5.x Head插件安装的更多相关文章

  1. Elasticsearch5 及 head插件 安装说明

    Elasticsearch5.X及 head插件 安装说明: 1.下载elasticsearch安装文件: a) 下载官方源码: https://artifacts.elastic.co/downlo ...

  2. elasticsearch5.0及head插件安装

        这个瞎jb整了半天.准备把es2.4升级到5.0,结果老报错 环境:centos6.5+es2.4是ok的换成es5就出毛病.也不能说啥 ,我用的是最新的 源码解压启动时候报错,具体错误for ...

  3. [elk]elasticsearch5.0及head插件安装

    ElasticSearch2.3/2.4升级到ElasticSearch5.0 参考文档(排名不分先后)https://www.elastic.co/guide/en/elasticsearch/re ...

  4. elasticsearch及head插件安装与配置

    1. 环境软件版本说明 系统:ubuntu14.04.1 JDK:1.8 elasticsearch:5.5.2 node:9.11.1 elasticsearch:5.X 2. 环境软件下载说明 1 ...

  5. ElasticSearch 5.0及head插件安装

    一.elasticsearch安装配置 1.官网下载源码包 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0 ...

  6. ElasticSearch5.5.1插件分类

    ElasticSearch5.5.1插件分类 附官网介绍:https://www.elastic.co/guide/en/elasticsearch/plugins/5.5/intro.html 一. ...

  7. ElasticSearch安装和head插件安装

    本文主要介绍elasticsearch5.0安装及head插件安装.确保系统已经安装好jdk1.8以上,操作系统CentOS6以上. 一.elasticsearch安装配置 1.官网下载源码包 下载不 ...

  8. ELK安装和配置及常用插件安装

    环境 CentOS 7.3 root 用户 JDK 版本:1.8(最低要求),主推:JDK 1.8.0_121 以上 关闭 firewall systemctl stop firewalld.serv ...

  9. [Android Studio]SQLScout插件安装破解

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/5972138.html [Android Studio]SQLS ...

随机推荐

  1. sql里的ROW_NUMBER() OVER是啥意思?

    是一个分析函数,生成一个排序列select row_number(XX) over(partition by XXX order by XX [desc/asc]) frou table;partit ...

  2. CCPC-Wannafly Winter Camp Day5 Div1 - Sorting - [线段树]

    题目链接:https://zhixincode.com/contest/22/problem/I?problem_id=314 样例输入 1 5 9 31 5 3 2 41 1 52 1 51 1 1 ...

  3. 深入理解无穷级数和的定义(the sum of the series)

    Given an infinite sequence (a1, a2, a3, ...), a series is informally the form of adding all those te ...

  4. 【绿书】 模拟,rep大坑

    https://vjudge.net/contest/229603#problem/B 绿书题 大模拟,绿书上用了个比较麻烦的输入,其实只要getchar()!='0'就行 坑: rep(i,0,s. ...

  5. vue 错误分析

    1  点击事件发生的错误 原因是,重复触发事件函数导致   改为不一样的名字即可 2  提示 : “ vuex] Expects string as the type, but found undef ...

  6. confd

    1.下载安装confd ]# wget https://github.com/kelseyhightower/confd/releases/download/v0.15.0/confd-0.15.0- ...

  7. C# RichTextBox的用法

    https://www.cnblogs.com/arxive/p/5725570.html

  8. mac下安装debug坑

    mac默认情况下的php版本是很低的,当你直接用phpize的时候默认是使用mac默认安装的phpize版本,这个时候查看Phpinfo的时候是看不到xdebug的,这时候查看错误日志会收到这样的报错 ...

  9. Linux7安装Oracle 11g 86%报错:Error in invoking target 'agent nmhs' of makefile

    解决方案在makefile中添加链接libnnz11库的参数修改$ORACLE_HOME/sysman/lib/ins_emagent.mk,将$(MK_EMAGENT_NMECTL)修改为:$(MK ...

  10. ORACLE监听配置及测试实验(2)

    实验四 在tnsname.ora里添加默认监听代号 [oracle@oracle01 admin]$ vi tnsnames.ora 添加一行 PORT1528=(ADDRESS = (PROTOCO ...