1.Head插件简介

ElasticSearch-head是一个H5编写的ElasticSearch集群操作和管理工具,可以对集群进行傻瓜式操作。

  • 显示集群的拓扑,并且能够执行索引和节点级别操作
  • 搜索接口能够查询集群中原始json或表格格式的检索数据
  • 能够快速访问并显示集群的状态
  • 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果;
  • 5.0版本之前可以通过plugin名安装,5.0之后可以独立运行。

2.Head插件安装

2.1安装NodeJS

[root@node1 ~]# yum install -y nodejs

2.2安装npm

[root@node1 ~]#  npm install -g cnpm --registry=https://registry.npm.taobao.org

2.3使用npm安装grunt

[root@node1 ~]# npm install -g grunt
npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN gentlyRm not removing /usr/bin/grunt as it wasn't installed by /usr/lib/node_modules/grunt
/usr/bin/grunt -> /usr/lib/node_modules/grunt/bin/grunt
/usr/lib
└── grunt@1.0.1 [root@node1 ~]#
[root@node1 ~]# npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
/usr/lib
└─┬ grunt-cli@1.2.0
├─┬ findup-sync@0.3.0
│ └─┬ glob@5.0.15
│ ├─┬ inflight@1.0.6
│ │ └── wrappy@1.0.2
│ ├── inherits@2.0.3
│ ├─┬ minimatch@3.0.4
│ │ └─┬ brace-expansion@1.1.8
│ │ ├── balanced-match@1.0.0
│ │ └── concat-map@0.0.1
│ ├── once@1.4.0
│ └── path-is-absolute@1.0.1
├── grunt-known-options@1.1.0
├─┬ nopt@3.0.6
│ └── abbrev@1.1.1
└── resolve@1.1.7 [root@node1 ~]#

2.4版本确认

[es@node1 ~]$ node -v
v6.12.0
[es@node1 ~]$ npm -v
3.10.10
[es@node1 ~]$ grunt -version
grunt-cli v1.2.0
[es@node1 ~]$

3.安装head

3.1下载head插件源码

[es@node1 ~]$ wget https://github.com/mobz/elasticsearch-head/archive/master.zip
--2017-12-18 09:58:08-- https://github.com/mobz/elasticsearch-head/archive/master.zip
Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/mobz/elasticsearch-head/zip/master [following]
--2017-12-18 09:58:09-- https://codeload.github.com/mobz/elasticsearch-head/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.255.120, 192.30.255.121
Connecting to codeload.github.com (codeload.github.com)|192.30.255.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 921421 (900K) [application/zip]
Saving to: ‘master.zip’ 100%[===============================================================>] 921,421 9.64KB/s in 67s 2017-12-18 09:59:18 (13.4 KB/s) - ‘master.zip’ saved [921421/921421] [es@node1 ~]$ ls
master.zip
[es@node1 ~]$ unzip master.zip

3.2下载依赖

进入elasticsearch-head-master目录,执行下面命令:

[es@node1 elasticsearch-head-master]$ npm install

> phantomjs-prebuilt@2.1.16 install /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt
> node install.js PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1515165531727/phantomjs-2.1.1-linux-x86_64 -> /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/es/elasticsearch-head-master/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
elasticsearch-head@0.0.0 /home/es/elasticsearch-head-master
└─┬ grunt-contrib-jasmine@1.0.3
└─┬ grunt-lib-phantomjs@1.1.0
└── phantomjs-prebuilt@2.1.16 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
[es@node1 elasticsearch-head-master]$

如果上面命令安装较慢或失败,可以尝试国内镜像安装

[es@node1 elasticsearch-head-master]$ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
[sudo] password for es:
/usr/bin/cnpm -> /usr/lib/node_modules/cnpm/bin/cnpm
/usr/lib
└─┬ cnpm@5.1.1
├─┬ npminstall@3.3.0
│ ├── binary-mirror-config@1.7.3
│ ├── moment@2.20.1
│ └─┬ tar@4.2.0
│ └── minizlib@1.1.0
└─┬ urllib@2.25.3
└─┬ proxy-agent@2.1.0
└─┬ pac-proxy-agent@2.0.0
└─┬ socks-proxy-agent@3.0.1
└─┬ agent-base@4.1.2
└─┬ es6-promisify@5.0.0
└── es6-promise@4.2.2 [es@node1 elasticsearch-head-master]$ cnpm install
⠸ [6/10] Installing json-schema-traverse@^0.3.0platform unsupported karma@1.3.0 › chokidar@1.7.0 › fsevents@^1.0.0 Package require os(darwin) not compatible with your platform(linux)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(linux)
✔ Installed 10 packages
✔ Linked 313 latest versions
PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1515223629881/phantomjs-2.1.1-linux-x86_64 -> /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/es/elasticsearch-head-master/node_modules/_phantomjs-prebuilt@2.1.16@phantomjs-prebuilt/lib/phantom/bin/phantomjs
✔ Run 1 scripts
deprecate grunt-contrib-connect@1.0.2 › http2@^3.3.4 Use the built-in module in node 9.0.0 or newer, instead
deprecate grunt@1.0.1 › coffee-script@~1.10.0 CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
anti semver karma@1.3.0 › useragent@2.2.1 › tmp@0.0.x delcares tmp@0.0.x(resolved as 0.0.33) but using ancestor(karma)'s dependency tmp@0.0.28(resolved as 0.0.28)
✔ All packages installed (365 packages installed from npm registry, used 17s, speed 497.82kB/s, json 323(581.43kB), tarball 7.64MB)
[es@node1 elasticsearch-head-master]$

4.配置

4.1停止ElasticSearch

如果ElasticSearch已经启动,需要先停止

[es@node1 ~]$ jps
3261 Elasticsearch
3375 Jps
[es@node1 ~]$ kill 3261

4.2配置 ElasticSearch,使得HTTP对外提供服务

[es@node1 elasticsearch-6.1.1]$ vi config/elasticsearch.yml

添加如下内容

# 增加新的参数,这样head插件可以访问es。设置参数的时候:后面要有空格
http.cors.enabled: true
http.cors.allow-origin: "*"

4.3 修改Head插件配置文件

[es@node1 elasticsearch-head-master]$ vi Gruntfile.js

找到connect:server,添加hostname一项,如下

connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}

5.启动

5.1启动elasticsearch

首先确认elasticsearch已经启动

[es@node1 elasticsearch-6.1.1]$ bin/elasticsearch -d
[es@node1 elasticsearch-6.1.1]$ jps
3451 Jps
3436 Elasticsearch
[es@node1 elasticsearch-6.1.1]$

5.2启动head

通过命令grunt server启动head

[es@node1 elasticsearch-head-master]$ grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

或者通过命令npm run start也可以启动head

[es@node1 elasticsearch-head-master]$ npm run start

> elasticsearch-head@0.0.0 start /home/es/elasticsearch-head-master
> grunt server Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

5.3访问9100端口

http://node1:9100/


如果出现“未连接”,请修改localhost为node1,然后单击“连接”按钮

6 简单应用

6.1创建索引

[root@node1 ~]# curl -XPUT node1:9200/test
{"acknowledged":true,"shards_acknowledged":true,"index":"test"}[root@node1 ~]#

6.2查看head变化

 

ES系列二、CentOS7安装ES head6.3.1的更多相关文章

  1. ES系列一、CentOS7安装ES 6.3.1、集成IK分词器

    Elasticsearch 6.3.1 地址: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3. ...

  2. Centos7安装ES 和 Docker搭建ES

    本文版权归博客园和作者吴双本人共同所有 转载和爬虫请注明原文地址 www.cnblogs.com/tdws 一.linux centos7.x安装ES 1.下载java sudo yum instal ...

  3. ELK搭建<二>:安装ES插件head

    1.去github下载head,针对ES版本不同,安装方式也不一样, =>在2.x以前版本可以通过插件安装 for Elasticsearch 2.x: sudo elasticsearch/b ...

  4. 基于GTK+3 开发远程控制管理软件(C语言实现)系列二 Centos7下开发环境搭建

    一.安装gcc gcc-c++ make等编译工具 yum install gcc gcc-c++ kernel-devel 这一步,其实可以不用做,你在安装Centos7的时候,如果选择开发模式安装 ...

  5. centos7安装es

    #安装java1.8rpm -ivh jdk-8u191-linux-x64.rpm #解压estar -zxvf elasticsearch-6.4.0.tar.gz -C /usr #修改es限制 ...

  6. ES系列(二):基于多播的集群发现实现原理解析

    ES作用超强悍的搜索引擎,除了需要具有齐全的功能支持,超高的性能,还必须要有任意扩展的能力.一定程度上,它是一个大数据产品.而要做扩展性,集群自然少不了.然而单独的集群又是不够的,能够做的事情太少,所 ...

  7. ES系列十五、ES常用Java Client API

    一.简介 1.先看ES的架构图 二.ES支持的客户端连接方式 1.REST API http请求,例如,浏览器请求get方法:利用Postman等工具发起REST请求:java 发起httpClien ...

  8. ES系列十四、ES聚合分析(聚合分析简介、指标聚合、桶聚合)

    一.聚合分析简介 1. ES聚合分析是什么? 聚合分析是数据库中重要的功能特性,完成对一个查询的数据集中数据的聚合计算,如:找出某字段(或计算表达式的结果)的最大值.最小值,计算和.平均值等.ES作为 ...

  9. Docker系列之CentOS7安装Docker(一)

    0.前言 整体架构目录:ASP.NET Core分布式项目实战-目录 一.瞎扯淡(只讲有用的) 感兴趣的同学可以上网搜索一下docker具体的介绍.我这边主要介绍偏实战的内容,不喜勿喷,有问题也请指出 ...

随机推荐

  1. [luogu1962]斐波那契数列

    来提供两个正确的做法: 斐波那契数列双倍项的做法(附加证明) 矩阵快速幂 一.双倍项做法 在偶然之中,在百度中翻到了有关于斐波那契数列的词条(传送门),那么我们可以发现一个这个规律$ \frac{F_ ...

  2. 洛谷 P1490 买蛋糕 解题报告

    P1490 买蛋糕 题目描述 野猫过生日,大家当然会送礼物了(咳咳,没送礼物的同志注意了哈!!),由于不知道送什么好,又考虑到实用性等其他问题,大家决定合伙给野猫买一个生日蛋糕.大家不知道最后要买的蛋 ...

  3. django MTV架构下的网站开发步骤

    1.需求分析必不可少,一定要具体列出本次网站项目所要实现的目标,可能包括简单的页面草图与功能方块图等. 2.数据库设计. 3.了解网站的每一个页面,并设计网页模板(.html)文件 4.使用virtu ...

  4. cocos2d-x入门学习笔记,主要介绍cocos2d-x的基本结构,并且介绍引擎自带的示例

    cocos2d-x 3.0 制作横版格斗游戏 http://philon.cn/post/cocos2d-x-3.0-zhi-zuo-heng-ban-ge-dou-you-xi http://blo ...

  5. 51nod1238 最小公倍数之和 V3

    又被这神仙题给坑爆了. 神仙题解. 一开始我把lcm变成ij/gcd然后按照常规套路去推,推到最后发现不是miu * Id而是miu · Id......这还搞鬼啊. 正解居然跟这个差不多,先转成求其 ...

  6. Java基类和派生类

    背景:对基类和派生类有更清晰的认识. 从外部看来,派生类是一个与基类具有相同接口的新类,或许还会有一些额外的的方法和域 .但继承并不仅仅是类的复用.当创建了一个派生类的对象时,该类包含了一个基类的子对 ...

  7. html中空格字符实体整理

    摘要 浏览器总是会截短 HTML 页面中的空格.如果您在文本中写 10 个空格,在显示该页面之前,浏览器会删除它们中的 9 个.如需在页面中增加空格的数量,您需要使用 字符实体. 本篇就单介绍空格的字 ...

  8. windows 下mysql 重设root密码方法

    1.首先在命令行里关闭mysql服务 net stop mysql2.在命令行里进入mysql安装目录下bin目录,以不检查权限的方式启动:mysqld-nt  --skip-grant-tables ...

  9. 关闭应用程序(主程序)(WPF)

    很多人认为关闭应用程序应该很简单,例如WindowsForm里一个Application.Exit();方法就可以解决问题,但在WPF里面可别滥用,因为WPF里Application类没有该方法,倒是 ...

  10. @RequestBody

    之前写过一篇记录文章,写的是将一个比较复杂的数据结构在前台组合起来后传递到后台. 当时并不太了解@RequestBody,也并没有使用js提供的JSON.stringify()方法 所有都是自己写的, ...