查看集群状态,修复
GET _cluster/allocation/explain?pretty
GET /_cluster/allocation/explain
get /_cluster/settings
PUT /_cluster/settings
{
"transient": {
"cluster.routing.allocation.enable": "none"
}
}
#分片配置
PUT /_cluster/settings
{
"transient": {
"cluster.routing.allocation.enable": "all"
}
}
#分片重新均衡分配
PUT /_cluster/settings
{
"transient": {
"cluster.routing.rebalance.enable": "all"
}
}
# 设置副本数量
PUT /aabb/_settings
{
"number_of_replicas" : 2
}
get _cluster/health?level=indices
GET _cat/nodes?v&h=ip,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role,m
curl http://localhost:9200/_cat/nodes?v&h=ip,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role,m
get _cat/master
post /_cluster/reroute
{
"commands": [
{
"allocate_empty_primary": {
"index": "wap_yonghu_v1",
"shard": 2,
"node": "Ee6ubnnmT52LJchcw0P-pQ",
"accept_data_loss": false
}
}
]
}
#数据丢失
post /_cluster/reroute
{
"commands": [
{
"allocate_empty_primary": {
"index": "aabb_v2",
"shard": 0,
"node": "Ee6ubnnmT52LJchcw0P-pQ",
"accept_data_loss": true
}
}
]
}
#数据不丢失
post /_cluster/reroute
{
"commands" : [ {
"allocate_stale_primary" : {
"index" : "aabb_v2",
"shard" :0,
"node" : "Ee6ubnnmT52LJchcw0P-pQ",
"accept_data_loss" : true
}
}]
}
POST /_cluster/reroute?retry_failed=true
手动迁移分片
POST /_cluster/reroute
{
"commands": [
{
"move": {
"index": "aabb_v1",
"shard": 1,
"from_node": "10.10.20.143",
"to_node": "10.10.20.153"
}
}
]
}
...约 1153 字大约 4 分钟
