在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. Android所有Demo资源汇总,太全了(申明:来源于网络)

    Android所有Demo资源汇总,太全了(申明:来源于网络) 地址:http://bbs.csdn.net/topics/391928947

  2. 启动elk中elasticsearch服务报错which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)

    解决办法: vi /etc/sysconfig/elasticsearch JAVA_HOME=/usr/local/java sudo systemctl restart elasticsearch ...

  3. CentOS搭建内网NTP服务器

      在企业内部网络,不是所有的服务器都可以连接外网,需要搭建一台可以连接外网的服务器用于NTP服务器 安装环境查看 安装ntp yum -y install ntp 修改配置文件 driftfile ...

  4. linux内核添加模块

    参考: http://blog.csdn.net/gaoguoxin2/article/details/50220665 动态添加模块不需要编译内核. LINUX的模块主要由6部分组成: 1.模块的加 ...

  5. Ajax框架---dwr的用法

    通常使用Ajax时用的都是jQuery框架,现在公司的框架里用的都是dwr.我觉得dwr和jQuery中的ajax用法差不多,看起来也很像. 一.简介 百度百科上对dwr的描述: DWR采取了一个类似 ...

  6. Google、微软、Linkedln、Uber、亚马逊等15+海外技术专家聚首2018TOP100Summit

    11月30日-12月3日,由msup主办的第七届全球软件案例研究峰会(以下简称为TOP100Summit)将在北京国家会议中心举办.本届峰会以“释放AI生产力,让组织向智能化演进”作为开幕式主题, 4 ...

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

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

  8. Mac开发博客摘录

    https://blog.csdn.net/wangyouxiang/article/details/17855255 https://www.cocoacontrols.com/controls?p ...

  9. mysql 事务队列 写入 幂等性 重复写入

    mysql  事务队列   写入 幂等性  重复写入

  10. vmware为我们提供了三种网络工作模式,它们分别是:Bridged(桥接模式)、NAT(网络地址转换模式)、Host-Only(仅主机模式)。

    原文来自http://note.youdao.com/share/web/file.html?id=236896997b6ffbaa8e0d92eacd13abbf&type=note 我怕链 ...