非正常关闭后 OrientDB 恢复

标签 orientdb

当 OrientDB 因某人重新启动机器而非正常关闭时,OrientDB 最终会处于数据恢复失败的状态。对于如何从这种不正常的关闭中正常恢复有什么建议吗?我们正在寻找系统在断电期间能够自行恢复的方法。

通用输出,正如许多人可能已经看到的那样。

<DATE> WARNING {db=TestDb} segment file 'database.ocf' was not closed correctly last time [OSingleFileSegment]
<DATE> WARNING {db=TestDb} Storage TestDb was not closed properly. Will try to restore from write ahead log. [OLocalPaginatedStorage]
<DATE> INFO  {db=TestDb} Looking for last checkpoint... [OLocalPaginatedStorage]
<DATE> INFO  {db=TestDb} FULL checkpoint found. [OLocalPaginatedStorage]
<DATE> INFO  {db=TestDb} Data restore procedure from full checkpoint is started. Restore is performed from LSN OLogSequenceNumber{segment=0, position=322830} [OLocalPaginatedStorage]

Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OCheckpointEndRecord{lsn=OLogSequenceNumber{segment=0, position=322854}} will be skipped during data restore. [OLocalPaginatedStorage]{db=TestDb} Exception during storage data restore.
java.lang.ArrayIndexOutOfBoundsException: 33
    at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OAtomicUnitEndRecord.fromStream(OAtomicUnitEndRecord.java:59)
    at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALRecordsFactory.fromStream(OWALRecordsFactory.java:121)
    at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.read(ODiskWriteAheadLog.java:1009)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.restoreFrom(OAbstractPaginatedStorage.java:2261)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.restoreFromFullCheckPoint(OAbstractPaginatedStorage.java:2231)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.restoreFromCheckPoint(OAbstractPaginatedStorage.java:2220)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.restoreFromWAL(OAbstractPaginatedStorage.java:2171)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.restoreIfNeeded(OAbstractPaginatedStorage.java:1493)
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:154)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:223)
    at com.orientechnologies.orient.server.OServer.openDatabase(OServer.java:631)
    at com.orientechnologies.orient.server.OServer.openDatabase(OServer.java:613)
    at com.orientechnologies.orient.server.network.protocol.http.command.OServerCommandAuthenticatedDbAbstract.authenticate(OServerCommandAuthenticatedDbAbstract.java:167)
    at com.orientechnologies.orient.server.network.protocol.http.command.OServerCommandAuthenticatedDbAbstract.beforeExecute(OServerCommandAuthenticatedDbAbstract.java:127)
    at com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetConnect.beforeExecute(OServerCommandGetConnect.java:50)
    at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:171)
    at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:574)
    at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)

<DATE> SEVERE {db=TestDb} Internal server error:
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '<location>/orientdb-enterprise-2.1-rc1/databases/TestDb' with mode=rw

最佳答案

我在 Nexus 3.10 上遇到了类似的问题(内部使用 OrientDB 2.2.X),但显然数据库现在能够正常恢复,我第一次连接时收到警告,但第二次它被清理:

[centos@localhost nexus-3.10.0-04]$ java -jar lib/support/nexus-orient-console.jar 

OrientDB console v.2.2.31 (build 285537d2767275f460df32c6a3be01bfff6a517c, branch 2.2.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> connect plocal:/home/centos/nexus310/sonatype-work/nexus3/db/component admin admin

Connecting to database [plocal:/home/centos/nexus310/sonatype-work/nexus3/db/component] with user 'admin'...
2018-10-16 15:26:59:037 WARNI {db=component} Storage 'component' was not closed properly. Will try to recover from write ahead log...
2018-10-16 15:26:59:042 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=61, position=2073}} will be skipped during data restore
2018-10-16 15:26:59:043 WARNI {db=component} Record OFuzzyCheckpointStartRecord{lsn=LSN{segment=61, position=2080}} com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointStartRecord{lsn=null, previousCheckpoint=LSN{segment=61, position=2033}} will be skipped during data restore
2018-10-16 15:26:59:043 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=61, position=2120}} will be skipped during data restoreOK
orientdb {db=component}> exit

[centos@localhost nexus-3.10.0-04]$ java -jar lib/support/nexus-orient-console.jar 

OrientDB console v.2.2.31 (build 285537d2767275f460df32c6a3be01bfff6a517c, branch 2.2.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> connect plocal:/home/centos/nexus310/sonatype-work/nexus3/db/component admin admin

Connecting to database [plocal:/home/centos/nexus310/sonatype-work/nexus3/db/component] with user 'admin'...OK
orientdb {db=component}> 

关于非正常关闭后 OrientDB 恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30652440/

相关文章:

php - 使用 docker-compose 保持容器事件并链接

database - 每当实体在应用程序中更新时更新另一个数据库的高效设计

java - 如何使用 Java 在 Vertex 的 map 字段中保存 ODocument

neo4j - 可选节点聚合

java - 在java中使用gremlin获取两个节点之间的所有路径

graph-databases - 使用 OrientDB 递归遍历有向边

python-3.x - Graph Factory 找不到 gremlin.graph 属性配置

由 tglman 编写的 C++ OrientDB 库

scala - 如何从 Scala/Play 2.2 项目中使用 OrientDB?