我在本地的windows Elasticsearch数据库中有一个single node cluster
,我成功地对我的索引进行了快照。我在我的VMware中有一个3 nodes cluster
,每个节点(服务器)都是Ubuntu。虽然我成功地将快照恢复到单节点集群,但现在我在将特殊索引恢复到多节点集群时遇到了问题。我注册了一个名为"快照"的文件夹。作为我在本地Elasticsearch-7.10-win64中的存储库,我从该文件夹中的索引中获取了一些快照:
PUT /_snapshot/my_fs_backup
{
"type": "fs",
"settings": {
"location": "D:\snapshots",
"compress": true
}
}
PUT /_snapshot/my_fs_backup/snapshot_1? wait_for_completion = true
{
"indices": "suggestionindex",
"ignore_unavailable": true,
"include_global_state": false,
"metadata": {
"taken_by": "Ehsan",
"taken_because": "Testing"
}
}
我已经完成了windows,现在我们来看看3 Ubuntu servers
。我在所有3个节点上创建了一个名为snapshots
的共享NFS文件夹,如下所示:Elasticsearch:基于NFS共享的快照备份我在我的3 nodes cluster
中注册了我的存储库,如下所示:
PUT /_snapshot/my_fs_backup
{
"type": "fs",
"settings": {
"location": "/var/lib/elasticsearch/snapshots",
"compress": true
}
}
现在是时候恢复我的snapshot_1我的3 node cluster
。因此,我将本地快照文件夹中的全部内容复制到共享地址/var/lib/elasticsearch/snapshots
。现在恢复snapshot_1:
POST /_snapshot/my_fs_backup/snapshot_1/_restore?wait_for_completion=true
{
"indices": "suggestionindex",
"ignore_unavailable": true,
"include_global_state": false,
"include_aliases": false
}
和响应是:(Dev Tools in Kibana)
{
"snapshot" : {
"snapshot" : "snapshot_1",
"indices" : [
"suggestionindex"
],
"shards" : {
"total" : 1,
"failed" : 1,
"successful" : 0
}
}
}
我不知道什么是错的,但也许这些信息可能是有用的:
POST /_snapshot/my_fs_backup/_verify
结果:
{
"nodes" : {
"-S8rY_jOQMCvbAXvTRKQDw" : {
"name" : "node-1"
},
"y4ZQBhkCTV6jcARKjvvh5A" : {
"name" : "node-3"
},
"qlNcOrrJTtmvOOs4gCHgTw" : {
"name" : "node-2"
}
}
}
POST /_snapshot/my_fs_backup/all
结果:
{
"error" : {
"root_cause" : [
{
"type" : "snapshot_exception",
"reason" : "[my_fs_backup:all/4afsnEkiSd6MErwY_V-9GQ] Indices don't have primary shards [suggestionindex]"
}
],
"type" : "snapshot_exception",
"reason" : "[my_fs_backup:all/4afsnEkiSd6MErwY_V-9GQ] Indices don't have primary shards [suggestionindex]"
},
"status" : 500
}
Get /_cat/shards?v
结果:
suggestionindex 0 r UNASSIGNED
suggestionindex 0 p UNASSIGNED
.kibana 0 r STARTED 21 88.4kb 192.168.254.136 node-3
.kibana 0 p STARTED 21 88.5kb 192.168.254.135 node-2
我在3 nodes cluster
中使用与本地windows 10相同的代码创建了suggestionIndex
,在node-2上有一个主分片,在node-3上有副本,然后我关闭了suggestionindex
并再次尝试恢复快照,但仍然存在相同的问题,它不会被分配!
您可以从命令中获取未分配的分片原因:curl localhost:9200/_cat/shards?h=i,s,pr,st,n,ur,ua,uf,ud | grep UNASSIGNED
请共享上面的输出命令?