【elasticsearch】4、基本概念

2020-03-09  本文已影响0人  cutieagain

文档

json文档

json文档

上篇通过csv文件装换的数据

{
    "@version" => "1",
          "id" => "177939",
       "genre" => [
        [0] "Animation",
        [1] "Romance"
    ],
        "year" => 2017,
       "title" => "The Night Is Short, Walk on Girl"
}

文档的元数据

文档的元数据

索引

索引

索引的不同语义

elasticsearch集群中

type

抽象和类比

rdbms(关系型数据库) elasticsearch
table index(type)
row document
column filed
schema mapping
sql dsl

提供了rest-api 容易被各种语言调用

rest-api

一些基本的api

kibana应用

kibana应用-索引管理

index相关api

#查看索引相关信息
GET kibana_sample_data_ecommerce

#查看索引的文档总数
GET kibana_sample_data_ecommerce/_count

#查看前10条文档,了解文档格式
POST kibana_sample_data_ecommerce/_search
{
}

#_cat indices API
#查看indices
GET /_cat/indices/kibana*?v&s=index

#查看状态为绿的索引
GET /_cat/indices?v&health=green

#按照文档个数排序
GET /_cat/indices?v&s=docs.count:desc

#查看具体的字段
GET /_cat/indices/kibana*?pri&v&h=health,index,pri,rep,docs.count,mt

#How much memory is used per index?
GET /_cat/indices?v&h=i,tm&s=tm:desc

节点,集群,分片以及副本

分布式系统的可用性和拓展性

分布式特性

节点

master-eligible nodes 和 master node

data node (数据)和 coordinating node (协调)

其他的节点类型

配置节点类型

在elasticsearch.yml中配置

节点类型 配置参数 默认值
master eligible node.master true
data node.data true
ingest node.ingest true
coordinating onlu 每个节点默认都是coordinating节点,设置其他类型全部为false
machine learning node.ml true(需要enable x-pack)

分片(primary shard & replica shard)

分片示例

分片的设定

查看集群的健康状况

健康状态

demo

get _cluster/health
get _cat/nodes
get _cat/shards

get _cat/nodes?v
GET /_nodes/es7_01,es7_02
GET /_cat/nodes?v
GET /_cat/nodes?v&h=id,ip,port,v,m


GET _cluster/health
GET _cluster/health?level=shards
GET /_cluster/health/kibana_sample_data_ecommerce,kibana_sample_data_flights
GET /_cluster/health/kibana_sample_data_flights?level=shards

#### cluster state
The cluster state API allows access to metadata representing the state of the whole cluster. This includes information such as
GET /_cluster/state

#cluster get settings
GET /_cluster/settings
GET /_cluster/settings?include_defaults=true

GET _cat/shards
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason
上一篇下一篇

猜你喜欢

热点阅读