查看集群健康信息
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
获取集群堆积的任务