2023-02-05 Elasticsearch 集群 节点 分片
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
对于jdk的理解
http://localhost:9201/
{
"name":"node-1001 节点名字",
"cluster_name":"my-application 集群名称",
"cluster_uuid":"X0g8sUVJR06TCKe2vSVvtg",
"version":{
"number":"7.8.0",
"build_flavor":"default",
"build_type":"zip",
"build_hash":"757314695644ea9a1dc2fecd26d1a43856725e65",
"build_date":"2020-06-14T19:35:50.234439Z",
"build_snapshot":false,
"lucene_version":"8.5.1",
"minimum_wire_compatibility_version":"6.8.0",
"minimum_index_compatibility_version":"6.0.0-beta1"
},
"tagline":"You Know, for Search"
}
1 节点的理解
- 每个节点就是一个Elasticsearch的实例
- 一个节点≠一台服务器
节点角色 - master 候选节点并不是主节点是在master宕机的时候作为候选主节点
- data 数据节点
- data_content 数据内容节点
- data_hot 热节点 经常被访问
- data_warm 索引不再定期更新但仍可查询
- data_code 冷节点只读索引
- Ingest 预处理节点作用类似于Logstash中的Filter
- ml 机器学习节点
- remote_cluster_client 候选客户端节点
- transform 转换节点
- voting_only 仅投票节点
2 分片的理解
- 一个索引包含一个或多个分片在7.0之前默认五个主分片每个主分片一个副本在7.0之后默认一个主分片副本可以在索引创建之后修改数量但是主分片的数量一旦确定不可修改
- 每个分片都是一个Lucene实例有完整的创建索引和处理请求的能力
- ES会自动在nodes上做分片均衡
- 一个doc不可能同时存在于多个主分片中但是当每个主分片的副本数量不为一时可以同时存在于多个副本中
- 每个主分片和其副本分片不能同时存在于同一个节点上所以最低的可用配置是两个节点互为主备
3 集群的理解
- 原生分布式
- 一个节点≠一台服务器
Green: 所有Prinmgary和Replica均为active集群健康
Yellow: 至少一个Replica不可用但是所有Primary均为active数据仍然是可以保证完整性的。
Red: 至少有一个Primary为不可用状态数据不完整集群不可用。
健康值检查
_cat/health
_cluster/health
http://localhost:9201/_cluster/health
{
"cluster_name":"my-application",
"status":"green",
"timed_out":false,
"number_of_nodes":3,
"number_of_data_nodes":3,
"active_primary_shards":3,
"active_shards":9,
"relocating_shards":0,
"initializing_shards":0,
"unassigned_shards":0,
"delayed_unassigned_shards":0,
"number_of_pending_tasks":0,
"number_of_in_flight_fetch":0,
"task_max_waiting_in_queue_millis":0,
"active_shards_percent_as_number":100
}