elasticsearch5.0.1叢集索引分片丟失的處理
阿新 • • 發佈:2019-01-08
問題描述:
索引voice:live:logout的0分割槽的主分割槽和複製分割槽全部丟失,叢集狀態是紅色,並且新的資料無法寫入
如下
curl 10.26.241.237:9200/_cat/shards
voice:live:logout 0 p UNASSIGNED
voice:live:logout 0 r UNASSIGNED
解決思路:
將現有的資料備份出來,然後重新匯入
具體步驟:
1.先備份資料和mapping:
# 備份mapping
/root/node_modules/elasticdump/bin/elasticdump --ignore-errors=true --scrollTime=120m --bulk=true --input=http://10.26.241.237:9200/voice:live:logout --output=voice_live_logout_mapping.json --type=mapping
# 備份資料
/root/node_modules/elasticdump/bin/elasticdump --ignore-errors=true --scrollTime=120m --bulk=true --input=http://10.26.241.237:9200/voice:live:logout --output=voice_live_logout_data.json --type=data
2.刪除現有的voice:live:logout索引
curl -X DELETE http://10.26.241.237:9200/voice:live:logout
3.再次匯入剛才備份的資料
# 匯入mapping
/root/node_modules/elasticdump/bin/elasticdump --input=voice_live_logout_mapping.json --output=http://10.26.241.237:9200/voice:live:logout --type=mapping
# 匯入資料
node_modules/elasticdump/bin/elasticdump --input=voice_live_logout_data.json --output=http://10.26.241.237:9200/voice:live:logout --type=data
可以看到叢集恢復了
$ curl 10.26.241.237:9200/_cluster/health?pretty
{
"cluster_name" : "chinasoft_es",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 11,
"number_of_data_nodes" : 10,
"active_primary_shards" : 91,
"active_shards" : 182,
"relocating_shards" : 2,
"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
}
索引voice:live:logout的0分割槽的主分割槽和複製分割槽全部丟失,叢集狀態是紅色,並且新的資料無法寫入
如下
curl 10.26.241.237:9200/_cat/shards
voice:live:logout 0 p UNASSIGNED
voice:live:logout 0 r UNASSIGNED
解決思路:
將現有的資料備份出來,然後重新匯入
具體步驟:
1.先備份資料和mapping:
# 備份mapping
/root/node_modules/elasticdump/bin/elasticdump --ignore-errors=true --scrollTime=120m --bulk=true --input=http://10.26.241.237:9200/voice:live:logout --output=voice_live_logout_mapping.json --type=mapping
# 備份資料
/root/node_modules/elasticdump/bin/elasticdump --ignore-errors=true --scrollTime=120m --bulk=true --input=http://10.26.241.237:9200/voice:live:logout --output=voice_live_logout_data.json --type=data
2.刪除現有的voice:live:logout索引
curl -X DELETE http://10.26.241.237:9200/voice:live:logout
3.再次匯入剛才備份的資料
# 匯入mapping
/root/node_modules/elasticdump/bin/elasticdump --input=voice_live_logout_mapping.json --output=http://10.26.241.237:9200/voice:live:logout --type=mapping
# 匯入資料
node_modules/elasticdump/bin/elasticdump --input=voice_live_logout_data.json --output=http://10.26.241.237:9200/voice:live:logout --type=data
可以看到叢集恢復了
$ curl 10.26.241.237:9200/_cluster/health?pretty
{
"cluster_name" : "chinasoft_es",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 11,
"number_of_data_nodes" : 10,
"active_primary_shards" : 91,
"active_shards" : 182,
"relocating_shards" : 2,
"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
}