我正在尝试让Orient DB运行嵌入式和分布式。现在,只要我打开本地数据库,如果hazelcast插件处于活动状态,我就会遇到StackOverflowError。当我关闭hazelcast插件时,一切都很好。
OrientDB陷入了这个循环:
at com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin.onOpen(ODistributedAbstractPlugin.java:141)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:107)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:49)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:118)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:49)
at com.orientechnologies.orient.server.OServer.openDatabase(OServer.java:657)
at com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver.startup(ODefaultReplicationConflictResolver.java:74)
at com.orientechnologies.orient.server.distributed.OStorageSynchronizer.<init>(OStorageSynchronizer.java:56)
at com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin.getDatabaseSynchronizer(ODistributedAbstractPlugin.java:197)
at com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin.onOpen(ODistributedAbstractPlugin.java:141)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:107)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:49)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:118)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:49)
at com.orientechnologies.orient.server.OServer.openDatabase(OServer.java:657)
at com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver.startup(ODefaultReplicationConflictResolver.java:74)
at com.orientechnologies.orient.server.distributed.OStorageSynchronizer.<init>(OStorageSynchronizer.java:56)
at com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin.getDatabaseSynchronizer(ODistributedAbstractPlugin.java:197)
at com.orientechnologies.orient.server.distributed.ODistributedAbstractPlugin.onOpen(ODistributedAbstractPlugin.java:141)
ODatabaseRaw.open有一个监听器列表,当Hazelcast处于活动状态时,插件被注册为监听器,并且每次运行该方法时都会调用它。
任何人都有任何想法?
编辑: 我有点工作,我从github采取了分布式配置。当我删除以下行时,它可以工作:
<parameter name="conflict.resolver.impl" value="com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver" />
我不确定这是否是一个很好的解决方案,所以请随意指出更好的解决方案=)
我的完整配置如下所示: db.config:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
<network>
<protocols>
<protocol name="binary" implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary"/>
<protocol name="http" implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb"/>
</protocols>
<listeners>
<listener ip-address="0.0.0.0" port-range="2480-2490" protocol="http"/>
</listeners>
</network>
<users>
<user name="root" password="ThisIsA_TEST" resources="*"/>
</users>
<properties>
<entry name="server.cache.staticResources" value="false"/>
<entry name="server.database.path" value="."/>
<entry name="log.console.level" value="info"/> <entry name="log.file.level" value="fine"/>
</properties>
<handlers>
<handler class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
<parameters>
<!-- <parameter name="alias" value="europe1" /> -->
<parameter name="enabled" value="true" />
<parameter name="configuration.db.default" value="src/main/resources/default-distributed-db-config.json" />
<parameter name="configuration.hazelcast" value="src/main/resources/hazelcast.xml" />
<parameter name="alignment.startup" value="true" />
<parameter name="alignment.timer" value="120000" />
</parameters>
</handler>
</handlers>
</orient-server>
default-distributed-db-config.json(github上的示例中缺少'}':
{
"synchronization" : true,
"clusters" : {
"internal" : { "synchronization" : false },
"ODistributedConflict" : { "synchronization" : false },
"*" : {
"synchronization" : true,
"master" : "$auto",
"synch-replicas" : 0,
"asynch-replicas" : "100%" },
"index" : { "synchronization" : false }
}
}
hazelcast.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>orientdb</name>
<password>orientdb</password>
</group>
<network>
<port auto-increment="true">5701</port>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="true">
<interface>127.0.0.1</interface>
</tcp-ip>
</join>
</network>
</hazelcast>
EDIT2:
当两个实例尝试同步时获取另一个StackOverflowError:
java.lang.StackOverflowError
-> com.hazelcast.core.DistributedTask.get(DistributedTask.java:126)
-> com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin$1.done(OHazelcastPlugin.java:204)
-> com.hazelcast.impl.ExecutorManager$3.run(ExecutorManager.java:355)
-> com.hazelcast.impl.executor.ParallelExecutorService$ParallelExecutorImpl$ExecutionSegment.run(ParallelExecutorService.java:212)
-> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
-> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
-> java.lang.Thread.run(Thread.java:722)
-> com.hazelcast.impl.ExecutorThreadFactory$1.run(ExecutorThreadFactory.java:38)
null
-> com.hazelcast.core.DistributedTask.get(DistributedTask.java:126)
-> com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin$1.done(OHazelcastPlugin.java:204)
-> com.hazelcast.impl.ExecutorManager$3.run(ExecutorManager.java:355)
-> com.hazelcast.impl.executor.ParallelExecutorService$ParallelExecutorImpl$ExecutionSegment.run(ParallelExecutorService.java:212)
-> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
-> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
-> java.lang.Thread.run(Thread.java:722)
-> com.hazelcast.impl.ExecutorThreadFactory$1.run(ExecutorThreadFactory.java:38)
运行分布式和嵌入式时似乎不太稳定。真是个耻辱,到目前为止都很喜欢......