# 原因1:
# ES采用默认配置(5分片,1副本),但实际我们本地是单机部署
$ curl -XGET 'http://localhost:9200/_cat/shards?v'
index shard prirep state docs store ip node
t1 2 p STARTED 0 283b 172.19.209.98 node-1
t1 2 r UNASSIGNED
t1 1 p STARTED 0 283b 172.19.209.98 node-1
t1 1 r UNASSIGNED
t1 3 p STARTED 0 283b 172.19.209.98 node-1
t1 3 r UNASSIGNED
t1 4 p STARTED 0 283b 172.19.209.98 node-1
t1 4 r UNASSIGNED
t1 0 p STARTED 0 283b 172.19.209.98 node-1
t1 0 r UNASSIGNED
t2 2 p STARTED 0 230b 172.19.209.98 node-1
t2 2 r UNASSIGNED
t2 1 p STARTED 0 230b 172.19.209.98 node-1
t2 1 r UNASSIGNED
t2 3 p STARTED 0 230b 172.19.209.98 node-1
t2 3 r UNASSIGNED
t2 4 p STARTED 0 230b 172.19.209.98 node-1
t2 4 r UNASSIGNED
t2 0 p STARTED 0 230b 172.19.209.98 node-1
t2 0 r UNASSIGNED
# 查看索引设置
GET http://localhost:9200/t2/_settings
{
"t2": {
"settings": {
"index": {
"creation_date": "1577030286504",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "n_68GinmQtSfXZxb-aOjsQ",
"version": {
"created": "7050099"
},
"provided_name": "t2"
}
}
}
}
# 修改副本
POST http://localhost:9200/t2/_settings
{
"number_of_replicas": "0"
}
$ curl -XGET 'http://localhost:9200/_cat/shards?v'
index shard prirep state docs store ip node
t1 2 p STARTED 0 283b 172.19.209.98 node-1
t1 1 p STARTED 0 283b 172.19.209.98 node-1
t1 3 p STARTED 0 283b 172.19.209.98 node-1
t1 4 p STARTED 0 283b 172.19.209.98 node-1
t1 0 p STARTED 0 283b 172.19.209.98 node-1
t2 2 p STARTED 0 283b 172.19.209.98 node-1
t2 1 p STARTED 0 283b 172.19.209.98 node-1
t2 3 p STARTED 0 283b 172.19.209.98 node-1
t2 4 p STARTED 0 283b 172.19.209.98 node-1
t2 0 p STARTED 0 283b 172.19.209.98 node-1
网友评论