我有一个嵌入式Neo4j v2.2.3三个相同的服务器设置,我试图将单个数据库转换为HA设置。我已尝试使用每个数据库组合开始HA进程:所有空的,一个空的并且都使用相同的数据库,但无济于事。由于某种原因,AFAIK Neo4j实例无法相互连接。我已经验证IP地址是正确的,端口5001应该是打开的。我也开了6001。
这是我的messages.log。
2015-06-25 20:37:16.461+0000 INFO [o.n.k.i.DiagnosticsManager]: --- INITIALIZED diagnostics START ---
2015-06-25 20:37:16.462+0000 INFO [o.n.k.i.DiagnosticsManager]: Neo4j Kernel properties:
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: ha.server_id=1
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: ha.server=:6001
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: online_backup_server=0.0.0.0:6362
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: ephemeral=false
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: ha.initial_hosts=[IP1]:5001,[IP2]:5001,[IP3]:5001
2015-06-25 20:37:16.467+0000 INFO [o.n.k.i.DiagnosticsManager]: online_backup_enabled=true
2015-06-25 20:37:16.468+0000 INFO [o.n.k.i.DiagnosticsManager]: ha.cluster_server=:5001
2015-06-25 20:37:16.468+0000 INFO [o.n.k.i.DiagnosticsManager]: store_dir=/var/neo4j
2015-06-25 20:37:16.468+0000 INFO [o.n.k.i.DiagnosticsManager]: org.neo4j.server.webserver.address=0.0.0.0
2015-06-25 20:37:16.468+0000 INFO [o.n.k.i.DiagnosticsManager]: org.neo4j.server.database.mode=HA
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: Diagnostics providers:
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: org.neo4j.kernel.configuration.Config
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: org.neo4j.kernel.info.DiagnosticsManager
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: SYSTEM_MEMORY
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: JAVA_MEMORY
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: OPERATING_SYSTEM
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: JAVA_VIRTUAL_MACHINE
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: CLASSPATH
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: LIBRARY_PATH
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: SYSTEM_PROPERTIES
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: LINUX_SCHEDULERS
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: NETWORK
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: NodeCache
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: RelationshipCache
2015-06-25 20:37:16.469+0000 INFO [o.n.k.i.DiagnosticsManager]: HighAvailabilityDiagnostics
...
2015-06-25 21:55:36.502+0000 INFO [o.n.k.i.DiagnosticsManager]: High Availability diagnostics
Member state:PENDING
State machines:
AtomicBroadcastMessage:start
AcceptorMessage:start
ProposerMessage:start
LearnerMessage:start
HeartbeatMessage:start
ElectionMessage:start
SnapshotMessage:start
ClusterMessage:start
Current timeouts:
最后两分钟后,我收到了一个交易异常:
Caused by: org.neo4j.graphdb.TransactionFailureException: Timeout waiting for database to become available and allow new transactions. Waited 2m. 2 reasons for blocking: Database is stopped, Cluster state is 'PENDING'.
我创建了一个用于创建
的graphDatabaseFactory = new HighlyAvailableGraphDatabaseFactory()
DatabaseServiceImpl(
graphDatabaseFactory
.newEmbeddedDatabaseBuilder(neo4jStoreDir)
.loadPropertiesFromFile(configFileLocation)
.newGraphDatabase())
这就是我的neo4j.properties的样子:
online_backup_enabled=true
online_backup_server=0.0.0.0:6362
org.neo4j.server.webserver.address=0.0.0.0
org.neo4j.server.database.mode=HA
ha.server_id=1
ha.cluster_server=0.0.0.0:5001
ha.server=0.0.0.0:6001
ha.initial_hosts=[IP1]:5001,[IP2]:5001,[IP3]:5001
我为这些属性尝试了很多不同的组合,并且还添加了neo4-server.properties中的suggested值,但没有任何帮助。我应该在哪里将neo4j-server.properties置于嵌入模式,或者不需要它们(这是我最初的猜测)?
可能有什么问题?是否甚至可以使用嵌入式Neo4j设置HA群集?
EDIT。我确保每台服务器都位于同一个子网上,服务器可以相互连接而不受阻碍。
答案 0 :(得分:1)
Neo4j绝对支持嵌入模式下的群集 - 您甚至可以在同一群集中混合使用服务器和嵌入式实例。
在嵌入模式下运行时,根本不需要neo4j-server.properties
的设置。
要检查的一些事项:
答案 1 :(得分:0)
所以问题是我使用new HighlyAvailableGraphDatabaseFactory().addKernelExtensions(myKernelExtensionsArray)
设置的内核扩展。不推荐使用addKernelExtensions
方法,但这些扩展在单个服务器设置中运行良好。但是,在此HA服务器设置上,它们由于某种原因而失败。
我可以通过将addKernelExtensions
的调用替换为registerTransacionEventHandler
来重用我的内核扩展。