ES常用操作命令

查看集群健康信息

curl -u elastic:password http://xxxx:9200/_cluster/health?pretty=true

 

{

  "cluster_name" : "oss-cluster",

  "status" : "green",

  "timed_out" : false,

  "number_of_nodes" : 6,

  "number_of_data_nodes" : 6,

  "active_primary_shards" : 1,

  "active_shards" : 2,

  "relocating_shards" : 0,

  "initializing_shards" : 0,

  "unassigned_shards" : 0,

  "delayed_unassigned_shards" : 0,

  "number_of_pending_tasks" : 0,

  "number_of_in_flight_fetch" : 0,

  "task_max_waiting_in_queue_millis" : 0,

  "active_shards_percent_as_number" : 100.0

}

 

查看主节点信息

curl -u elastic:rMDglyJS9AcQEZNArN00 http://134.128.229.117:9200/_cat/master?v

 

 

创建索引
curl -XPUT http://IP:port/(index)
创建类型
curl -XPUT http://IP:port/(index)/(type)
添加文档:一篇文档通常是数据的JSON表示
curl -XPUT http://IP:port/(indx)/(type)/(doc_id) -d ‘{“name”:”Elasticsearch”}’

 

查看集群节点信息

curl -u elastic:password http://ip:9200/_cat/nodes?v

curl -u elastic:password GET 'ip:9200/_cat/nodes?v'

 

1、查询设置集群状态

curl -XGET -u elastic:password http://xxx:9200/_cluster/health?pretty=true

pretty=true表示格式化输出

level=indices 表示显示索引状态

level=shards 表示显示分片信息

 

2、curl -XGET -u elastic:password http://xxxx:9200/_cluster/stats?pretty=true

显示集群系统信息,包括CPU JVM等等

 

3、curl -XGET -u elastic:password http://xxxx/_cluster/state?pretty=true

集群的详细信息。包括节点、分片等。

 

3、curl -XGET -u elastic:xxxx http://xxxx:9200/_cluster/pending_tasks?pretty=true

获取集群堆积的任务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值