ElasticSearch 獲取es信息以及索引操做

檢查集羣的健康狀況php

GET /_cat/health?vhtml

green:每一個索引的primary shard和replica shard都是active狀態的
yellow:每一個索引的primary shard都是active狀態的,可是部分replica shard不是active狀態,處於不可用的狀態
red:不是全部索引的primary shard都是active狀態的,部分索引有數據丟失了spa

快速查看集羣中有哪些索引 code

GET /_cat/indices?vhtm

建立索引blog

PUT /test_index

{
   "settings" : {
      "number_of_shards" : 3,
      "number_of_replicas" : 1
   }
}
test_index 表示索引的名稱
number_of_shards 表示分片數
number_of_replicas 表示副本數
成功會返回
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test_index"
}

刪除索引索引

DELETE /test_indexclass

 修改索引副本數test

PUT /my_temp_index/_settings { "number_of_replicas": 2 }

轉載請註明來自:http://www.cnblogs.com/phpshen/p/8668833.html集羣

相關文章
相關標籤/搜索