es 常用命令(一)

1、查看es 进程 

ps -ef|grep es

2. 查看es索引

curl -X GET http://xxx:port/_cat/indices?v

3. 检查集群监控状态

curl -X GET http://xxx:port/_cluster/health?pretty  # 巡检结果及影响:status:集群状态:Green(正常);Yellow(备份数据不可用,不影响正常工作); Red(主备数据不可用,影响正常工作)
4. 集群负载检查
 curl -X GET http://xxx:port/_cat/nodes?v

 heap.percent:堆内存使用率,平均超过70%表明资源紧张

cpu:CPU使用率,平均超过70%表明资源紧张

load_1m/load_5m/load_15m:节点负载,平均超过10表明资源紧张

5. 检查集群内索引大小

_cat/indices?v&s=pri.store.size

 7. 集群JVM内存使用检查

 _nodes/stats/jvm?pretty

 8. 插入测试索引

 curl -XPUT -H "Content-Type:application/json" http://esip:port/ww/_doc/1?pretty -d '{"name":"ww"}'

 

 

上图可以看出,es索引数量过多,两种解决方法:如下

 

加大bulk的 百分比(备注:ES的643版本内存回收效率不太行)

curl -H "Content-Type:application/json" -XPUT

xxx:port/_cluster/settings?pretty -d '{

"persistent": {

"indices.breaker.bulk.throttle": "98%",

"indices.breaker.search.throttle": "98%"

}

}'

查看es版本

curl -v esip:port

2)批量清理es索引

 cat /tmp/es.txt|awk '{print $3}'|grep 202010 >>/tmp/ESindex.txe
for i in $(cat /tmp/ESindex.txe);do curl -XDELETE esip:esport/$i; done

 

 

posted @ 2023-06-27 19:34  鱼丸粗面没鱼丸  阅读(8)  评论(0编辑  收藏  举报