本文是在以下 6 篇基础上的继续扩展版本,不求大而全,只求对实战有帮助。
1、干货 | Elasticsearch 运维实战常用命令清单
2、干货 | Elasticsearch Top10 监控指标
3、你不得不关注的 Elasticsearch Top X 关键指标
4、干货 | Elasticsearch 开发实战常用命令清单
5、干货 | Elasticsearch开发人员最佳实战指南
GET _cat/shards?v&h=index,shard,prirep,state,unassigned.reason&s=state:asc
PUT my-index-2021.05.30-000002/_settings
{"number_of_replicas": 0}
ps:主分片不可以修改(除非shrink),但:副本可以动态调整大小。
PUT /_cluster/settings
{
"transient": {
"cluster.routing.allocation.enable": "all"
}
}
POST /_cluster/reroute
{
"commands": [
{
"move": {
"index": "test",
"shard": 0,
"from_node": "node1",
"to_node": "node2"
}
},
{
"allocate_replica": {
"index": "test",
"shard": 1,
"node": "node3"
}
}
]
}
GET /_cat/allocation?v
使用率大于等于85%,知道已经达到警戒水位线了,要预警。
GET /_cat/nodes?v&h=host,name,version
集群多节点版本不一致,可能会引发各种未知异常。
PUT /my-index-000001/_settings
{
"index.search.slowlog.threshold.query.warn": "10s",
"index.search.slowlog.threshold.query.info": "5s",
"index.search.slowlog.threshold.query.debug": "2s",
"index.search.slowlog.threshold.query.trace": "500ms",
"index.search.slowlog.threshold.fetch.warn": "1s",
"index.search.slowlog.threshold.fetch.info": "800ms",
"index.search.slowlog.threshold.fetch.debug": "500ms",
"index.search.slowlog.threshold.fetch.trace": "200ms",
"index.search.slowlog.level": "info"
}
PUT my-index-000002
{
"mappings": {
"_routing": {
"required": true
}
}
}
POST /my-index-000001/_forcemerge
POST _bulk
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }
PUT /my-index-000001/_settings
{
"index" : {
"refresh_interval" : "30s"
}
}
PUT my-index-000001/_settings
{
"number_of_replicas": 0
}
PUT my-index-2021.06.03/_settings
{
"index": {
"translog": {
"durability": "async"
}
}
}
在 jvm.option 配置文件中(不支持动态调整,需要重启后生效)
ES_HEAP_SIZE=DESIRED_SIZE (e.g. "3g")
磁盘的三个警戒水位线需要再一次强调。如果 Elasticsearch 集群节点的磁盘空间不足,则会影响集群性能。
一旦可用存储空间低于特定阈值限制,它将开始阻止写入操作,进而影响数据进入集群。那么,如何扩展呢?
三个警戒水位线推荐阅读:你不得不关注的 Elasticsearch Top X 关键指标。

elasticsearch_monitoring_cheatsheet.pdf
https://www.elastic.co/guide/en/elasticsearch/reference/7.14/modules-cluster.html#disk-based-shard-allocation
https://www.elastic.co/guide/en/elasticsearch/reference/7.14/how-to.html


原文作者:铭毅天下Elasticsearch;如有侵权,请联系管理员删除。