【发布时间】:2016-03-24 23:33:38
【问题描述】:
我在嵌入式和分布式模式下使用 OrientDB 2.1.7,应用程序在两个节点(两个 Java 进程)上运行。
使用默认 JSON 数据库配置时,一切正常:
{
"autoDeploy": true,
"hotAlignment": false,
"executionMode": "undefined",
"readQuorum": 1,
"writeQuorum": 2,
"failureAvailableNodesLessQuorum": false,
"readYourWrites": true,
"servers": {
"*": "master"
},
"clusters": {
"internal": {
"replication": false
},
"index": {
"replication": false
},
"*": {
"servers": ["<NEW_NODE>"]
}
}
}
但是,我想将hotAlignment更改为“true”,但是当我这样做时,在启动节点2时出现以下错误(注意:此时数据库未部署到节点2,但已创建在节点 1)上:
2015-12-17 16:28:32:010 INFO [order2] 将数据库“test”的分布式配置文件保存到:./databases/test/distributed-config.json [OHazelcastPlugin]
2015-12-17 16:28:32:012 INFO [order2] 收到新状态 order2.test=ONLINE [OHazelcastPlugin]
2015-12-17 16:28:32:019 INFO [order2] 在队列 orientdb.node.order2.test.request [OHazelcastDistributedMessageService] 中找不到以前的消息
2015-12-17 16:28:32:043 INFO [order2] 发布数据库 order2.test 的在线状态... [OHazelcastDistributedDatabase]
2015-12-17 16:28:32:046 INFO [order2] 收到更新状态 order2.test=ONLINE [OHazelcastPlugin]
2015-12-17 16:28:32:052 INFO [order2] 类 'ORole',创建新的本地集群 'orole_order2' (id=-1) [OHazelcastPlugin]
2015-12-17 16:28:32:134 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 0/10... [ODistributedStorage]
2015-12-17 16:28:32:522 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 1/10... [ODistributedStorage]
2015-12-17 16:28:32:903 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 2/10...[ODistributedStorage]
2015-12-17 16:28:33:283 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 3/10...[ODistributedStorage]
2015-12-17 16:28:33:663 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 4/10... [ODistributedStorage]
2015-12-17 16:28:34:043 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 5/10...[ODistributedStorage]
2015-12-17 16:28:34:419 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 6/10... [ODistributedStorage]
2015-12-17 16:28:34:799 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 7/10...[ODistributedStorage]
2015-12-17 16:28:35:176 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 8/10... [ODistributedStorage]
2015-12-17 16:28:35:556 WARNI 在分布式节点上创建集群时出错:ID 不同(本地 = 9 和远程 = 15)。正在重试 9/10... [ODistributedStorage]
2015-12-17 16:28:35:910 SEVER [order2] 在类“ORole”中创建集群“orole_order2”时出错:[OHazelcastPlugin][order2] 启动分布式插件时出错
com.orientechnologies.orient.server.distributed.ODistributedException:在类“ORole”中创建集群“orole_order2”时出错
在 com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.installLocalClusterPerClass(OHazelcastPlugin.java:1624)
在 com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.installDbClustersForLocalNode(OHazelcastPlugin.java:1293)
在 com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.loadDistributedDatabases(OHazelcastPlugin.java:1434)
在 com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.startup(OHazelcastPlugin.java:187)
在 com.orientechnologies.orient.server.OServer.registerPlugins(OServer.java:979)
在 com.orientechnologies.orient.server.OServer.activate(OServer.java:346)
在 no.kommune.bergen.graftest.GraphDBServerWrapper.startDatabaseServer(GraphDBServerWrapper.java:74)
在 no.kommune.bergen.graftest.GraftestApplication.main(GraftestApplication.java:47)
在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
在 java.lang.reflect.Method.invoke(Method.java:483)
在 org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
在 java.lang.Thread.run(Thread.java:745)
原因:com.orientechnologies.orient.server.distributed.ODistributedException:在分布式节点上创建集群时出错:分配的本地和远程 id 不同
在 com.orienttechnologies.orient.server.distributed.ODistributedStorage.addCluster(ODistributedStorage.java:1364)
在 com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.addCluster(ODatabaseDocumentTx.java:1291)
在 com.orientechnologies.orient.core.metadata.schema.OClassImpl.createClusterIfNeeded(OClassImpl.java:2102)
在 com.orientechnologies.orient.core.metadata.schema.OClassImpl.addCluster(OClassImpl.java:1068)
在 com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin.installLocalClusterPerClass(OHazelcastPlugin.java:1617)
... 13 更多
在开启 hotAlignment 时,似乎无法为 node2 创建本地集群。关闭自动部署时,我也看到了同样的问题。 我的配置中是否缺少某些内容?
编辑:这是我们启动服务器的方式:
OServerConfiguration cfg = new OServerConfiguration();
//DB server config
cfg.handlers = new ArrayList<OServerHandlerConfiguration>();
//Cluster plugin config
OServerHandlerConfiguration hazelcastHandlerConfig = new OServerHandlerConfiguration();
hazelcastHandlerConfig.clazz = "com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin";
hazelcastHandlerConfig.parameters = new OServerParameterConfiguration[6];
hazelcastHandlerConfig.parameters[0] = new OServerParameterConfiguration("nodeName", nodeName);
hazelcastHandlerConfig.parameters[1] = new OServerParameterConfiguration("enabled", "true");
hazelcastHandlerConfig.parameters[2] = new OServerParameterConfiguration("configuration.db.default", "/config/distributed-db-config.json");
hazelcastHandlerConfig.parameters[3] = new OServerParameterConfiguration("configuration.hazelcast", "/config/hazelcast.xml");
hazelcastHandlerConfig.parameters[4] = new OServerParameterConfiguration("conflict.resolver.impl", "com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver");
hazelcastHandlerConfig.parameters[5] = new OServerParameterConfiguration("sharding.strategy.round-robin", "com.orientechnologies.orient.server.hazelcast.sharding.strategy.ORoundRobinPartitioninStrategy");
cfg.handlers.add(hazelcastHandlerConfig);
//Network config
cfg.network = new OServerNetworkConfiguration();
cfg.network.protocols = new ArrayList<OServerNetworkProtocolConfiguration>();
cfg.network.protocols.add(new OServerNetworkProtocolConfiguration("binary", "com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary"));
OServerNetworkListenerConfiguration binaryListenerCfg = new OServerNetworkListenerConfiguration();
binaryListenerCfg.ipAddress = "0.0.0.0";
binaryListenerCfg.portRange = "2424-2430";
binaryListenerCfg.protocol = "binary";
cfg.network.listeners = new ArrayList<>();
cfg.network.listeners.add(binaryListenerCfg);
//Storage config
OServerStorageConfiguration storageCfg = new OServerStorageConfiguration();
storageCfg.path = "plocal:./databases/test";
storageCfg.name = "test";
storageCfg.loadOnStartup = true;
cfg.storages = new OServerStorageConfiguration[]{storageCfg};
//User config
OServerUserConfiguration userCfg = new OServerUserConfiguration(username, password, "*");
cfg.users = new OServerUserConfiguration[]{userCfg};
databaseServer = OServerMain.create(true);
databaseServer.startup(cfg);
databaseServer.activate();
【问题讨论】:
-
是的,我明白了。但是我也尝试了 2.2 beta,然后我得到了同样的错误。关于将服务器配置为同时使用自动部署和热对齐的任何想法?
-
你的数据库是什么类型的?本地化?
-
是的,数据库服务器使用“plocal:./databases/test”作为存储启动。我们正在使用 OServerMain 运行嵌入式服务器。
标签: orientdb