轉載自https://www.cnblogs.com/phpshen/p/8668833.html
檢查集群的健康情況
GET /_cat/health?v
green:每個索引的primary shard和replica shard都是active狀態的
yellow:每個索引的primary shard都是active狀態的,但是部分replica shard不是active狀態,處於不可用的狀態
red:不是所有索引的primary shard都是active狀態的,部分索引有數據丟失了
快速查看集群中有哪些索引
GET /_cat/indices?v
創建索引
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_index
修改索引副本數
PUT /my_temp_index/_settings
{
"number_of_replicas": 2
}