使用curl命令操作elasticsearch
第一:_cat系列 _cat系列提供了一系列查询elasticsearch集群状态的接口。你可以通过执行 curl -XGET localhost:9200/_cat 获取所有_cat系列的操作 =^.^= /_cat/allocation /_cat/shards /_cat/shards/{index} /_cat/master /_cat/nodes /_cat/indices /_cat/indices/{index} /_cat/segments /_cat/segments/{index} /_cat/count /_cat/count/{index} /_cat/recovery /_cat/recovery/{index} /_cat/health /_cat/pending_tasks /_cat/aliases /_cat/aliases/{alias} /_cat/thread_pool /_cat/plugins /_cat/fielddata /_cat/fielddata/{fields} 你也可以后面加一个v,让输出内容表格显示表头,举例 name component version type url Prometheus analysis-mmseg NA j Prometheus analysis-pinyin NA j Prometheus analysis-ik NA j Prometheus analysis-ik NA j Prometheus analysis-smartcn 2.1.0 j Prometheus segmentspy NA s /_plugin/segmentspy/ Prometheus head NA s /_plugin/head/ Prometheus bigdesk NA s /_plugin/bigdesk/ Xandu analysis-ik NA j Xandu analysis-pinyin NA j Xandu analysis-mmseg NA j Xandu analysis-smartcn 2.1.0 j Xandu head NA s /_plugin/head/ Xandu bigdesk NA s /_plugin/bigdesk/ Onyxx analysis-ik NA j Onyxx analysis-mmseg NA j Onyxx analysis-smartcn 2.1.0 j Onyxx analysis-pinyin NA j Onyxx head NA s /_plugin/head/ Onyxx bigdesk NA s /_plugin/bigdesk/ 第二:_cluster系列 1、查询设置集群状态 curl -XGET localhost:9200/_cluster/health?pretty=true pretty=true表示格式化输出 level=indices 表示显示索引状态 level=shards 表示显示分片信息 2、curl -XGET localhost:9200/_cluster/stats?pretty=true 显示集群系统信息,包括CPU JVM等等 3、curl -XGET localhost:9200/_cluster/state?pretty=true 集群的详细信息。包括节点、分片等。 3、curl -XGET localhost:9200/_cluster/pending_tasks?pretty=true 获取集群堆积的任务 3、修改集群配置 举例: ...