您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
# Elasticsearch-Head插件安装教程
## 一、插件简介
Elasticsearch-Head是Elasticsearch的一个开源Web前端插件,提供可视化界面用于管理ES集群。主要功能包括:
- 集群健康状态监控
- 索引数据浏览与查询
- 节点信息查看
- 执行RESTful API操作
- 数据可视化展示
## 二、安装前准备
### 环境要求
1. 已安装Elasticsearch(5.x/6.x/7.x版本)
2. Node.js 10+ 环境
3. npm 或 yarn 包管理工具
4. Git客户端(可选)
### 检查环境
```bash
# 检查Elasticsearch版本
curl -X GET "localhost:9200"
# 检查Node.js环境
node -v
npm -v
chrome-extension://[extension-id]/_plugin/elasticsearch-head/
注意:此方式无法自定义配置,适合快速体验
# 拉取官方镜像
docker pull mobz/elasticsearch-head:5
# 运行容器
docker run -d -p 9100:9100 mobz/elasticsearch-head:5
# 访问界面
http://localhost:9100
配置跨域(修改elasticsearch.yml):
http.cors.enabled: true
http.cors.allow-origin: "*"
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
编辑_site/app.js
:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
npm run start
http://localhost:9100
修改config/elasticsearch.yml
:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"
重启ES服务使配置生效。
server {
listen 80;
server_name es-head.example.com;
location / {
proxy_pass http://localhost:9100;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# 清除npm缓存
npm cache clean --force
# 重新安装依赖
rm -rf node_modules
npm install
ES版本 | Head版本 |
---|---|
5.x | 5.x |
6.x | 6.x |
7.x | 最新master分支 |
{
"query": {
"match_all": {}
},
"size": 10
}
支持可视化构建bool查询、范围查询等复杂条件
生产环境建议:
配置示例:
http.cors.allow-origin: "https://your-domain.com"
工具 | 优点 | 缺点 |
---|---|---|
elasticsearch-head | 轻量、简单 | 功能较基础 |
Kibana | 功能全面 | 资源占用高 |
Cerebro | 专业集群管理 | 需要单独部署 |
本文详细介绍了三种elasticsearch-head的安装方式,推荐生产环境使用源码编译安装。安装完成后,您可以通过浏览器轻松管理Elasticsearch集群,建议结合Nginx配置域名访问并启用安全防护。
注意:Elasticsearch 8.x版本已内置部分管理功能,建议评估是否需要额外安装管理插件 “`
这篇教程包含了: 1. 详细的安装步骤 2. 多种安装方式对比 3. 配置说明和截图示例 4. 常见问题解决方案 5. 安全建议 6. 替代方案比较
可根据实际需求调整内容细节,补充更多截图或具体操作示例。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。