一、集群检查常用命令
- 查询集群状态命令:
curl -XGET "http://ip:port/_cluster/health?pretty"
- 查询Es全局状态:
curl -XGET "http://ip:port/_cluster/stats?pretty"
- 查询集群设置
curl -XGET "http://ip:port/_cluster/settings?pretty"
- 查看集群文档总数
curl -XGET "http://ip:port/_cat/count?v"
- 查看集群文档总数
curl -XGET "http://ip:port/_cat/count?v"
- 查看集群别名组
curl -XGET "http://ip:port/_cat/aliases"
6.查看当前集群索引分片信息curl -XGET "http://ip:port/_cat/shards?v"注:查看某一个索引可用shards/索引名?v
7.查看集群实例存储详细信息curl -XGET "http://ip:port/_cat/allocation?v"
8.查看当前集群的所有实例curl -XGET "http://ip:port/_cat/nodes?v"
9.查看某索引分片转移进度curl -XGET "http://ip:port/_cat/recovery/索引名?v"
【ES集群检查常用命令】10.查看当前集群等待任务curl -XGET "http://ip:port/_cat/pending_tasks?v"
11.查看集群写入线程池任务curl -XGET "http://ip:port/_cat/thread_pool/bulk?v"
12.查看集群查询线程池任务curl -XGET "http://ip:port/_cat/thread_pool/search?v"
13.查看分片未分配的原因curl -XGET "http://127.0.0.1:24100/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason" | grep UNASSIGNED
二、集群设置常用命令- 设置集群分片恢复参数
curl -XPUT"http://ip:httpport/_cluster/settings"-H'Content-Type: application/json' -d' { "transient": {"cluster.routing.allocation.node_initial_primaries_recoveries":60,"cluster.routing.allocation.node_concurrent_recoveries":30,"cluster.routing.allocation.cluster_concurrent_rebalance":30} }'
- 根据实例名称使EsNodeX实例下线:
curl -XPUT"http://ip:httpport/_cluster/settings" -H 'Content-Type: application/json' -d' {"transient": {"cluster.routing.allocation.exclude._name": "EsNode2@ip"} }'
- 根据ip使ES数据节点下线:
curl -XPUT"http://ip:httpport/_cluster/settings" -H 'Content-Type: application/json' -d' {"transient": {"cluster.routing.allocation.exclude._ip": "ip1,ip2,ip3"} }'
- 设置分片恢复过程中的最大带宽速度:
curl -XPUT "http://127.0.0.1:24100/_cluster/settings" -H 'Content-Type: application/json' -d'{ "transient":{"indices.recovery.max_bytes_per_sec":"500mb"}}'
- 重新分片为空的主分片
curl -XPOST"http://127.0.0.1:24100/_cluster/reroute?pretty" -H 'Content-Type:application/json' -d '{"commands": [{"allocate_empty_primary": {"index": "indexname","shard": 2,"node": "EsNode1@81.20.5.24","accept_data_loss":true}}]}'
- 重新分配主分片,会尝试将过期副本分片分片为主 。
curl -XPOST "http://127.0.0.1:24100/_cluster/reroute?pretty" -H 'Content-Type:application/json' -d '{"commands": [{"allocate_stale_primary": {"index": "index1","shard": 2,"node": "EsNode1@189.39.172.103","accept_data_loss":true}}]}'
- 清理ES所有缓存
curl -XPOST "http://ip:port/_cache/clear"
8.关闭分片自动平衡curl -XPUT "http://ip:port/_cluster/settings" -H 'Content-Type:application/json' -d '{"transient":{"cluster.routing.rebalance.enable":"none" }}'
9.手动刷新未分配的分片curl -XPOST "http://127.0.0.1:24100/_cluster/reroute?retry_failed=true"
三、索引查看常用命令- 查询索引mapping和settings
curl -XGET --tlsv1.2--negotiate -k -u : 'https://ip:port/my_index_name?pretty'
- 查询索引settings
curl -XGET--tlsv1.2--negotiate -k -u : 'https://ip:port/my_index_name/_settings?pretty'
经验总结扩展阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 脱敏牙膏有哪些?
- docker swarm快速部署redis分布式集群
- java中的垃圾回收算法与垃圾回收器
- 男士孕前检查注意什么
- 哪些人需要检查hpv检查
- 白带能检查出艾滋病吗
- 免费孕前检查在哪里
- 宫颈粘连检查疼吗
- 白带常规检查挂什么科
- 要备孕该做些什么检查