ELK常用命令

时间:2023-03-09 17:07:38
ELK常用命令

1、查询当前所有的索引

#curl 'localhost:9200/_cat/indices?v'

2、查看集群健康状态

#curl 'localhost:9200/_cat/health?v'

绿色表示一切正常, 黄色表示所有的数据可用但是部分副本还没有分配,红色表示部分数据因为某些原因不可用

3、产看node情况

#curl 'localhost:9200/_cat/nodes?v'

4、创建索引

#curl -XPUT 'localhost:9200/customer?pretty'

5、删除某个索引

#curl -XDELETE 'localhost:9200/customer?pretty'

删除多个索引

#curl -XDELETE 'localhost:9200/customer-*?pretty'

#curl -XDELETE 'localhost:9200/customer,customer2?pretty'

6、索引的增删改查有一个类似的格式,总结如下:

  curl -X<REST Verb> <Node>:<Port>/<Index>/<Type>/<ID>

  <REST Verb>:REST风格的语法谓词

  <Node>:节点ip

  <port>:节点端口号,默认9200

  <Index>:索引名

  <Type>:索引类型

  <ID>:操作对象的ID号