Fork me on GitHub
Suzf  Blog

How-to Install Web Admin Tool On Elasticsearch 5

License: Attribution-NonCommercial-ShareAlike 4.0 International

本文出自 Suzf Blog。 如未注明,均为 SUZF.NET 原创。

转载请注明:http://suzf.net/post/1365

Head Plugin

Running as a plugin of Elasticsearch (deprecated)

for Elasticsearch 5.x: site plugins are not supported. Run as a standalone server for Elasticsearch 2.x: sudo elasticsearch/bin/plugin install mobz/elasticsearch-head open http://localhost:9200/_plugin/head/

Run as a standalone server

Install dependencies packages
# yum install git nodejs -y

# node -v
v6.10.1

# npm -v
3.10.10
使用 npm 安装 grunt
# npm install -g grunt-cli
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
/usr/lib
└─┬ [email protected] 
├─┬ [email protected] 
│ └─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └─┬ [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ └── [email protected] 
└── [email protected]
Running with built in server
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install


# 如果速度较慢或者安装失败,可以使用国内镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org

Connecting to elasticsearch

By default elasticsearch exposes a http rest API on port 9200 which elasticsearch-head connects to.

Enable CORS in elasticsearch

*** 所有 Head 插件要监控的节点 都需要添加  ***

# tail -3 /etc/elasticsearch/elasticsearch.yml 
# Elasticsearch-head setting
http.cors.enabled: true
http.cors.allow-origin: /https?:\/\/172.16.9.50(:[0-9]+)?/
修改 Gruntfile.js

默认监听在127.0.0.1下9200端口

@monkey elasticsearch-head]# grep "connect: {" -A 9 -n Gruntfile.js
90:		connect: {
91-			server: {
92-				options: {
93-					hostname: '0.0.0.0',
94-					port: 9100,
95-					base: '.',
96-					keepalive: true
97-				}
98-			}
99-		}
启动 elasticsearch-head

在 elasticsearch-head/ 目录下,运行启动命令:

[root@monkey elasticsearch-head]# grunt  server
# OR
[root@monkey elasticsearch-head]# npm run start
 浏览器访问 http://172.16.9.50:9100/

es5_head_plugin

Cerebro

当然除了 Head Plugin 之外还有一些其他的插件。 比如 kopf: 不过此插件已在 ES3 的时候移除,同时也不在支持 ES5。

https://github.com/lmenezes/elasticsearch-kopf/issues/390

不过一个新的插件 - cerebro 可以运行在 ES5。

cerebro is an open source(MIT License) elasticsearch web admin tool built using Scala, Play Framework, AngularJS and Bootstrap.

安装也是相当简单的,只需下载解压运行就能迅速启动了。PS: Java JDK >= 1.8

Cerebro Installation

  1. Download from https://github.com/lmenezes/cerebro/releases
  2. Extract files
  3. Run bin/cerebro(or bin/cerebro.bat if on Windows)
  4. Access on http://localhost:9000

cerebro-demo Reference

[0] https://www.elastic.co/guide/en/elasticsearch/plugins/5.3/index.html

[1] https://www.elastic.co/blog/running-site-plugins-with-elasticsearch-5-0

[2] https://github.com/mobz/elasticsearch-head

[3] https://github.com/lmenezes/cerebro

「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」

Suzf Blog

(๑>ڡ<)☆ 谢谢 ~

使用微信扫描二维码完成支付