当前位置: 首页 > news >正文

ES系列二、CentOS7安装ES head6.3.1

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变化 这里写图片描述

 

转载于:https://www.cnblogs.com/wangzhuxing/p/9352258.html

相关文章:

  • 对整型、浮点型、字符串类型的认识
  • DNS域名解析中A、AAAA、CNAME、MX、NS、TXT、SRV、SOA、PTR各项记录的作用
  • 交互式数据处理
  • 在项目中直接执行里面的文件
  • Redis监听回调
  • P1064 金明的预算方案
  • windows C:\documents and settings拒绝访问
  • 枚举+最短路 poj1062
  • Python——requests模块
  • GitLab领取任务+建立分支+本地修改+上传分支+合并分支详细步骤
  • Win10应用商店缓存信息多如何去清理?
  • [数位DP][CQOI2016]手机号码(附数位DP模板)
  • SpringBoot | 第十一章:Redis的集成和简单使用
  • 搭建简单的单个Mybatis框架
  • Day 14:FileInputStream、FileOutputStream
  • 《Java8实战》-第四章读书笔记(引入流Stream)
  • 「前端」从UglifyJSPlugin强制开启css压缩探究webpack插件运行机制
  • Android框架之Volley
  • Java 内存分配及垃圾回收机制初探
  • Java,console输出实时的转向GUI textbox
  • JS 面试题总结
  • JS进阶 - JS 、JS-Web-API与DOM、BOM
  • LeetCode29.两数相除 JavaScript
  • Node + FFmpeg 实现Canvas动画导出视频
  • PHP面试之三:MySQL数据库
  • Twitter赢在开放,三年创造奇迹
  • Webpack 4 学习01(基础配置)
  • web标准化(下)
  • 关于Flux,Vuex,Redux的思考
  • 算法之不定期更新(一)(2018-04-12)
  • 微信小程序--------语音识别(前端自己也能玩)
  • 中文输入法与React文本输入框的问题与解决方案
  • ​HTTP与HTTPS:网络通信的安全卫士
  • ​secrets --- 生成管理密码的安全随机数​
  • ​sqlite3 --- SQLite 数据库 DB-API 2.0 接口模块​
  • ​比特币大跌的 2 个原因
  • # 数据结构
  • $$$$GB2312-80区位编码表$$$$
  • $.proxy和$.extend
  • (20)目标检测算法之YOLOv5计算预选框、详解anchor计算
  • (C语言)共用体union的用法举例
  • (Java岗)秋招打卡!一本学历拿下美团、阿里、快手、米哈游offer
  • (草履虫都可以看懂的)PyQt子窗口向主窗口传递参数,主窗口接收子窗口信号、参数。
  • (超详细)2-YOLOV5改进-添加SimAM注意力机制
  • (翻译)Entity Framework技巧系列之七 - Tip 26 – 28
  • (附源码)计算机毕业设计ssm-Java网名推荐系统
  • (一)C语言之入门:使用Visual Studio Community 2022运行hello world
  • (一)使用Mybatis实现在student数据库中插入一个学生信息
  • .[hudsonL@cock.li].mkp勒索加密数据库完美恢复---惜分飞
  • .NET CF命令行调试器MDbg入门(三) 进程控制
  • .net 写了一个支持重试、熔断和超时策略的 HttpClient 实例池
  • .NET 中小心嵌套等待的 Task,它可能会耗尽你线程池的现有资源,出现类似死锁的情况
  • .NET8.0 AOT 经验分享 FreeSql/FreeRedis/FreeScheduler 均已通过测试
  • @RequestParam详解
  • [100天算法】-二叉树剪枝(day 48)