@juniorspecialist
Джуниор

Почему при восстановлении базы Elasticsearch данные не восстанавливаются?

Всем привет.
Есть база на Elasticsearch 1.5, делаю бэкап её стандартными средствами
curl -XPUT 'http://localhost:9200/_snapshot/test' -d '{"type": "fs","settings": {"location": "/path","compress": true}}'

бэкап сохранился всё отлично. Потом закинул данные на сервер, там установлен elasticsearch 1.5.2 версии. Чистая установка нет никаких данных. Делаю восстановление -
curl -XPOST "http://my_ip:9200/_snapshot/test/snapshot_1/_restore?wait_for_completion=true"
видно, что эластик работает, пытается восстановить, процессы висят. размер бэкапа 200гиг. Спустя сутки после запуска восстановления - бэкап не восстановился. База данными не пополняется, а лишь пишутся логи, огромные логи.
[2015-06-09 07:22:02,920][WARN ][indices.cluster          ] [Batwing] [[bulks][5]] marking and sending shard failed due to [failed recovery]
org.elasticsearch.index.gateway.IndexShardGatewayRecoveryException: [bulks][5] failed recovery
	at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:162)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.index.snapshots.IndexShardRestoreFailedException: [bulks][5] restore failed
	at org.elasticsearch.index.snapshots.IndexShardSnapshotAndRestoreService.restore(IndexShardSnapshotAndRestoreService.java:135)
	at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:109)
	... 3 more
Caused by: org.elasticsearch.index.snapshots.IndexShardRestoreFailedException: [bulks][5] failed to restore snapshot [snapshot_1]
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository.restore(BlobStoreIndexShardRepository.java:164)
	at org.elasticsearch.index.snapshots.IndexShardSnapshotAndRestoreService.restore(IndexShardSnapshotAndRestoreService.java:126)
	... 4 more
Caused by: org.elasticsearch.index.snapshots.IndexShardRestoreFailedException: [bulks][5] Can't restore corrupted shard
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restore(BlobStoreIndexShardRepository.java:716)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository.restore(BlobStoreIndexShardRepository.java:162)
	... 5 more
Caused by: org.apache.lucene.index.CorruptIndexException: [bulks][5] Preexisting corrupted index [corrupted_dIp4fqTkQ7euY5ESwklBMg] caused by: CorruptIndexException[verification failed (hardware problem?) : expected=14dlt9i actual=null writtenLength=17241872 expectedLength=17242199 (resource=name [_1cpg.cfs], length [17242199], checksum [14dlt9i], writtenBy [4.10.4])]
org.apache.lucene.index.CorruptIndexException: verification failed (hardware problem?) : expected=14dlt9i actual=null writtenLength=17241872 expectedLength=17242199 (resource=name [_1cpg.cfs], length [17242199], checksum [14dlt9i], writtenBy [4.10.4])
	at org.elasticsearch.index.store.Store$LuceneVerifyingIndexOutput.verify(Store.java:1227)
	at org.elasticsearch.index.store.Store.verify(Store.java:460)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restoreFile(BlobStoreIndexShardRepository.java:813)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restore(BlobStoreIndexShardRepository.java:770)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository.restore(BlobStoreIndexShardRepository.java:162)
	at org.elasticsearch.index.snapshots.IndexShardSnapshotAndRestoreService.restore(IndexShardSnapshotAndRestoreService.java:126)
	at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:109)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

	at org.elasticsearch.index.store.Store.failIfCorrupted(Store.java:547)
	at org.elasticsearch.index.store.Store.failIfCorrupted(Store.java:528)
	at org.elasticsearch.index.store.Store.getMetadata(Store.java:219)
	at org.elasticsearch.index.store.Store.getMetadataOrEmpty(Store.java:185)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restore(BlobStoreIndexShardRepository.java:713)
	... 6 more
[2015-06-09 07:22:02,920][WARN ][cluster.action.shard     ] [Batwing] [bulks][5] received shard failed for [bulks][5], node[gjYJdwYVRWeA6QCUec-hZw], [P], restoring[test:snapshot_1], s[INITIALIZING], indexUUID [2UxyUL5BT4CunAdHYuceNQ], reason [shard failure [failed recovery][IndexShardGatewayRecoveryException[[bulks][5] failed recovery]; nested: IndexShardRestoreFailedException[[bulks][5] restore failed]; nested: IndexShardRestoreFailedException[[bulks][5] failed to restore snapshot [snapshot_1]]; nested: IndexShardRestoreFailedException[[bulks][5] Can't restore corrupted shard]; nested: CorruptIndexException[[bulks][5] Preexisting corrupted index [corrupted_dIp4fqTkQ7euY5ESwklBMg] caused by: CorruptIndexException[verification failed (hardware problem?) : expected=14dlt9i actual=null writtenLength=17241872 expectedLength=17242199 (resource=name [_1cpg.cfs], length [17242199], checksum [14dlt9i], writtenBy [4.10.4])]
org.apache.lucene.index.CorruptIndexException: verification failed (hardware problem?) : expected=14dlt9i actual=null writtenLength=17241872 expectedLength=17242199 (resource=name [_1cpg.cfs], length [17242199], checksum [14dlt9i], writtenBy [4.10.4])
	at org.elasticsearch.index.store.Store$LuceneVerifyingIndexOutput.verify(Store.java:1227)
	at org.elasticsearch.index.store.Store.verify(Store.java:460)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restoreFile(BlobStoreIndexShardRepository.java:813)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository$RestoreContext.restore(BlobStoreIndexShardRepository.java:770)
	at org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository.restore(BlobStoreIndexShardRepository.java:162)
	at org.elasticsearch.index.snapshots.IndexShardSnapshotAndRestoreService.restore(IndexShardSnapshotAndRestoreService.java:126)
	at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:109)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
]; ]]
  • Вопрос задан
  • 968 просмотров
Пригласить эксперта
Ответы на вопрос 1
mobilesfinks
@mobilesfinks
сисадмин *nix
бэкап сохранился всё отлично.

Как определил что всё отлично?

Caused by: org.apache.lucene.index.CorruptIndexException: [bulks][5] Preexisting corrupted index
...
Can't restore corrupted shard

индекс битый. Попробуй вот это
И ещё
  • проверь целостность файловой системы. Проверь оперативу. Просто что бы убедиться, что не в железе проблема.
  • Проверь целостность файловой системы на которой бэкап.
  • Попробуй восстановить на версию 1.5

Ещё 2 варианта:
- Попробуй перенести базу простым копированием через rsync.
- объедини оба сервера в кластер и пусть он сам перельёт все шарды на второй. Ты просто наблюдай за этим процессом через kopf, например.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
от 1 000 000 до 1 200 000 ₽
от 300 000 до 500 000 ₽
Сима-ленд Екатеринбург
от 120 000 до 250 000 ₽
28 апр. 2024, в 00:54
10000 руб./за проект
28 апр. 2024, в 00:53
70000 руб./за проект
27 апр. 2024, в 21:24
150000 руб./за проект