orientdb本地节点不是主节点

时间:2016-09-29 17:17:25

标签: java orientdb orientdb2.2

我们在具有5个节点的群集中使用OrientDB,并在其上添加Java API库。它们都使用2.2.8版本,我们正在使用Tinkerpop Blueprints版本2.6.0。我们遇到一个奇怪的问题,数据库运行良好一段时间,然后我们突然开始遇到下面的错误。我们刚开始遇到这个问题,因为我们从1.7升级到2.2。

我想知道是否有其他人之前遇到过此问题/错误,或者是否有人对我们可能需要更改以使多节点环境有效的建议有任何建议。

com.orientechnologies.orient.server.distributed.ODistributedConfigurationChangedException: Local node 'aNode' is not the master for cluster 'aCluster' (it is 'anotherNode')
    DB name="dbName"
    DB name="dbName"
    at sun.reflect.GeneratedConstructorAccessor61.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.throwSerializedException(OChannelBinaryAsynchClient.java:428)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:379)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:261)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:153)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:2133)
    at com.orientechnologies.orient.client.remote.OStorageRemote$28.execute(OStorageRemote.java:1316)
    at com.orientechnologies.orient.client.remote.OStorageRemote$28.execute(OStorageRemote.java:1289)
    at com.orientechnologies.orient.client.remote.OStorageRemote$2.execute(OStorageRemote.java:198)
    at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:230)
    at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperation(OStorageRemote.java:195)
    at com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:1289)
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:560)
    at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:106)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2733)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2703)
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:175)

1 个答案:

答案 0 :(得分:0)

我在两节点场景中看到类似的东西。在node1上保存文档(Java API)时,出现错误:

com.orientechnologies.orient.server.distributed.ODistributedConfigurationChangedException: Local node 'node1' is not the master for cluster 'event_3' (it is 'node2')
    DB name="********"
    DB name="********"
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.throwSerializedException(OChannelBinaryAsynchClient.java:428)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.handleStatus(OChannelBinaryAsynchClient.java:379)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:261)
    at com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClient.beginResponse(OChannelBinaryAsynchClient.java:153)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:2133)
    at com.orientechnologies.orient.client.remote.OStorageRemote$6.execute(OStorageRemote.java:543)
    at com.orientechnologies.orient.client.remote.OStorageRemote$6.execute(OStorageRemote.java:537)
    at com.orientechnologies.orient.client.remote.OStorageRemote$1.execute(OStorageRemote.java:166)
    at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:230)
    at com.orientechnologies.orient.client.remote.OStorageRemote.asyncNetworkOperation(OStorageRemote.java:158)
    at com.orientechnologies.orient.client.remote.OStorageRemote.createRecord(OStorageRemote.java:523)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeSaveRecord(ODatabaseDocumentTx.java:2075)
    at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveNew(OTransactionNoTx.java:246)
    at com.orientechnologies.orient.core.tx.OTransactionNoTx.saveRecord(OTransactionNoTx.java:179)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:2598)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:103)
    at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1800)
    at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1791)
    (... stack trace truncated here ...)

抛出异常的Java代码:

    OPartitionedDatabasePool pool = new OPartitionedDatabasePool(dbUrl, user, password);
    ...
    try (ODatabaseDocumentTx ignored = pool.acquire()) {
        ODocument document = new ODocument(className);
        document.fromJSON(recordData.encode());
        document.field("date", timestamp, OType.DATETIME);
        document.save();
    }

列表集群显示集群'event_3'确实归node2所有:

|#   |NAME        |  ID|CLASS     |CONFLICT-STRATEGY|COUNT|OWNER_SERVER|OTHER_SERVERS|AUTO_DEPLOY_NEW_NODE|
|14  |event_1     |  18|event     |                 |    1|  node1     |  [node2]    |        true        |
|15  |event_2     |  19|event     |                 |    1|  node1     |  [node2]    |        true        |
|16  |event_3     |  20|event     |                 |    0|  node2     |  [node1]    |        true        |

在其他情况下插入成功,因此看起来只在某些情况下选择了错误的节点才能插入。