elasticsearch-head

elasticsearch-head 是用于监控 Elasticsearch 状态的客户端插件,包括数据可视化、执行增删改查操作等

安装前先安装nodejs

1.下载  地址

2.安装

npm install

3.运行

npm run start

浏览器打开 http://localhost:9100/

出现cluster health: not connected

解决方法:

  修改elasticsearch所在目录中 config/elasticsearch.yml

# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"

  重新启动elasticsearch

  修改 elasticsearch-head 目录下的 Gruntfile.js

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

  重新启动elasticsearch-head

4.使用

插入两条数据

curl -XPOST 'localhost:9200/store/category/1?pretty' -H 'Content-type:application/json' -d'{"name":"soap","type":"cleaning","postDate":"2019-9-15","message":"this is a first data"}'
curl -XPOST 'localhost:9200/store/category/2?pretty' -H 'Content-type:application/json' -d'{"name":"soap1","type":"cleaning","postDate":"2019-9-15","message":"this is a second data"}'

索引

数据浏览

 

 基本查询

 说明:  

集群健康值的几种状态如下:

绿色,最健康的状态,代表所有的分片包括备份都可用

黄色,基本的分片可用,但是备份不可用(也可能是没有备份)

红色,部分的分片可用,表明分片有一部分损坏。此时执行查询部分数据仍然可以查到,遇到这种情况,还是赶快解决比较好

灰色,未连接到elasticsearch服务

 

posted @ 2019-11-11 15:28  慕尘  阅读(1713)  评论(0编辑  收藏  举报