neo4j 1.6.M02数据库似乎已损坏;我该如何恢复?

时间:2012-02-16 12:59:46

标签: ubuntu neo4j corrupt-data

我在ubuntu机器上有一个neo4j实例,在服务启动时关闭。 因此,现在该服务拒绝启动:

Starting Neo4j Server... process [3807]... waiting for server to be ready.. BAD.
Neo4j Server may have failed to start, please check the logs.

和日志......

Feb 16, 2012 4:44:51 PM org.neo4j.server.logging.Logger log
INFO: Store files missing, or not in suitable state for upgrade. Leaving this problem for main server process to resolve.
Feb 16, 2012 4:44:51 PM org.neo4j.server.logging.Logger log
INFO: Starting Neo Server on port [7474] with [20] threads available
Feb 16, 2012 4:44:51 PM org.mortbay.log.Slf4jLog info
INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Feb 16, 2012 4:44:51 PM org.neo4j.server.logging.Logger log
INFO: Using database at /home/dan/personal/neo4j-community-1.6.M02/data/graph.db
Feb 16, 2012 4:44:52 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
INFO: Non clean shutdown detected on log [/home/dan/personal/neo4j-community-1.6.M02/data/graph.db/nioneo_logical.log.1]. Recovery started ...

任何想法怎么可以

  1. 恢复数据库?
  2. 如果机器再次出现故障,可以防止再次发生这种情况吗?
  3. 感谢

    更新 尝试运行sudo ./bin/neo4j-shell -path data/graph.db/,这是输出

    Feb 16, 2012 3:57:16 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
    INFO: Non clean shutdown detected on log [/home/dan/personal/neo4j-community-1.6.M02/data/graph.db/nioneo_logical.log.1]. Recovery started ...
    org.neo4j.graphdb.TransactionFailureException: Could not create data source [nioneodb], see nested exception for cause of error
        at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:161)
        at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:104)
        at org.neo4j.kernel.EmbeddedGraphDbImpl.<init>(EmbeddedGraphDbImpl.java:190)
        at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:78)
        at org.neo4j.shell.kernel.GraphDatabaseShellServer.instantiateGraphDb(GraphDatabaseShellServer.java:85)
        at org.neo4j.shell.kernel.GraphDatabaseShellServer.<init>(GraphDatabaseShellServer.java:57)
        at org.neo4j.shell.StartClient.tryStartLocalServerAndClient(StartClient.java:286)
        at org.neo4j.shell.StartClient.startLocal(StartClient.java:219)
        at org.neo4j.shell.StartClient.start(StartClient.java:159)
        at org.neo4j.shell.StartClient.main(StartClient.java:108)
    Caused by: java.lang.RuntimeException: Unexpected Exception
        at org.neo4j.helpers.Exceptions.launderedException(Exceptions.java:78)
        at org.neo4j.helpers.Exceptions.launderedException(Exceptions.java:48)
        at org.neo4j.helpers.Exceptions.launderedException(Exceptions.java:43)
        at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.<init>(NeoStoreXaDataSource.java:216)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:77)
        at org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:155)
        ... 9 more
    Caused by: java.io.IOException: Inject start failed, xid: GlobalId[NEOKERNL|3992629294259512899|39], BranchId[ 52 49 52 49 52 49 ] already injected
        at org.neo4j.kernel.impl.transaction.xaframework.XaResourceManager.injectStart(XaResourceManager.java:118)
        at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.applyStartEntry(XaLogicalLog.java:486)
        at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.applyEntry(XaLogicalLog.java:445)
        at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.doInternalRecovery(XaLogicalLog.java:815)
        at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.open(XaLogicalLog.java:241)
        at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.open(XaLogicalLog.java:187)
        at org.neo4j.kernel.impl.transaction.xaframework.XaContainer.openLogicalLog(XaContainer.java:120)
        at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.<init>(NeoStoreXaDataSource.java:177)
        ... 15 more
    ERROR (-v for expanded information):
        Could not create data source [nioneodb], see nested exception for cause of error
    
     -host      Domain name or IP of host to connect to (default: localhost)
     -port      Port of host to connect to (default: 1337)
     -name      RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
     -pid       Process ID to connect to
     -c         Command line to execute. After executing it the shell exits
     -readonly  Connect in readonly mode
     -path      Points to a neo4j db path so that a local server can be started there
     -config    Points to a config file when starting a local server
    
    Example arguments for remote:
        -port 1337
        -host 192.168.1.234 -port 1337 -name shell
        -host localhost -readonly
        ...or no arguments for default values
    Example arguments for local:
        -path /path/to/db
        -path /path/to/db -config /path/to/neo4j.config
        -path /path/to/db -readonly
    

1 个答案:

答案 0 :(得分:2)

好的,不幸的是你正在运行1.6.M02这个已知的问题可以让你的数据库处于这种状态。 1.6没有这个问题。还有另一个db在neo4j邮件列表上有这个问题,所以我创建了这个工具:http://pastebin.com/KuSTcaGM来修复这样一个破坏的日志。您是否觉得编译和运行起来很舒服?否则我可以把一个捆绑的jar放在一起,附上一个脚本,如:

$ ./fix-double-start-record-issue my / db

并以某种方式发送给你。