gpt4 book ai didi

java - orientdb本地节点不是master

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:07 25 4
gpt4 key购买 nike

我们在一个具有 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)

最佳答案

我在两个节点的场景中看到了类似的情况。在 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 |

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

关于java - orientdb本地节点不是master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39776367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com