License: Attribution-NonCommercial-ShareAlike 4.0 International
本文出自 Suzf Blog。 如未注明,均为 SUZF.NET 原创。
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/
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
- Download from https://github.com/lmenezes/cerebro/releases
- Extract files
- Run bin/cerebro(or bin/cerebro.bat if on Windows)
- Access on http://localhost:9000
[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