Neo4j Server没有连接到Rails中的嵌入式数据库

时间:2014-05-30 20:07:54

标签: ruby-on-rails neo4j

我试图将Neo4j服务器连接到嵌入在Rails项目中的数据库。我遵循本指南:https://github.com/andreasronge/neo4j/wiki/Neo4j%3A%3Aha-cluster我认为唯一不同的是我使用的是1.9.7 Neo4j社区服务器。我能够启动rails服务器和rails控制台,并且两者同时工作。我可以很好地启动独立服务器,但我只能在UI中看到根节点。

我试图将独立服务器指向两个嵌入式数据库中的一个,但服务器然后更新数据库,以便Rails应用程序不再启动。

如果您需要更多细节,请与我们联系。

欢迎任何提示。感谢。

这是独立服务器的neo4j.properties

    ha.server_id=3
    ha.initial_hosts=localhost:5001,localhost:5002,localhost:5003
    ha.server=localhost:6003
    ha.cluster_server=localhost:5003
    ha.pull_interval=1
    allow_store_upgrade=false
    keep_logical_logs=true

这是独立服务器的neo4j-server.properties

    org.neo4j.server.database.location=data/graph.db
    org.neo4j.server.database.mode=HA
    org.neo4j.server.webserver.port=7474
    org.neo4j.server.webserver.https.enabled=true
    org.neo4j.server.webserver.https.port=7473
    org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert
    org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key
    org.neo4j.server.webserver.https.keystore.location=data/keystore
    org.neo4j.server.webadmin.rrdb.location=data/rrd
    org.neo4j.server.webadmin.data.uri=/db/data/
    org.neo4j.server.webadmin.management.uri=/db/manage/
    org.neo4j.server.db.tuning.properties=conf/neo4j.properties
    org.neo4j.server.manage.console_engines=gremlin, shell
    org.neo4j.server.http.log.enabled=false
    org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml

这些是我的Gemfile中包含的与Noe4j和Rails相关的宝石:

    gem 'rails', '3.2.13'
    gem 'neo4j', '>= 2.2.3'
    gem 'neo4j-community', '1.9'
    gem 'neo4j-advanced', '1.9'
    gem 'neo4j-enterprise', '1.9'

在config / application.rb中我添加了:

   require "neo4j/rails/ha_console/railtie" if Rails.env.development?
   config.neo4j.storage_path = "#{config.root}/db/neo4j-#{Rails.env}" unless Rails.env.development?

当我启动rails服务器时:

   Config HA cluster, ha.server_id: 1, db: /Users/rene_user/Code/neo_pedigree/db/ha_neo_1
   => Booting WEBrick
   => Rails 3.2.13 application starting in development on http://0.0.0.0:3000
   => Call with -d to detach
   => Ctrl-C to shutdown server
   [2014-05-31 00:25:34] INFO  WEBrick 1.3.1
   [2014-05-31 00:25:34] INFO  ruby 1.9.3 (2013-12-06) [java]
   [2014-05-31 00:25:34] INFO  WEBrick::HTTPServer#start: pid=998 port=3000
   starting Neo4j in HA mode, machine id: 1 at localhost:6001 db /Users/rene_user/Code/neo_pedigree/db/ha_neo_1

启动rails控制台:

    Config HA cluster, ha.server_id: 1, db: /Users/rene_user/Code/neo_pedigree/db/ha_neo_1
    Re-Config HA cluster, ha.server_id: 2, db: /Users/rene_user/Code/neo_pedigree/db/ha_neo_2
    Loading development environment (Rails 3.2.13)
    irb(main):001:0> Dog.all.count
    starting Neo4j in HA mode, machine id: 2 at localhost:6002 db /Users/rene_user/Code/neo_pedigree/db/ha_neo_2
    => 3

启动独立的neo4j服务器:

    Using additional JVM arguments:  -server -XX:+DisableExplicitGC - Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
    Starting Neo4j Server...WARNING: not changing user
    HA instance started in process [39548]. Will be operational once connected to peers. See /Users/rene_user/Code/neo4j_server/data/log/console.log for current status.

这是从启动服务器开始的独立服务器日志:

    2014-05-29 16:45:53.169+0000 INFO  [API] Remote interface ready and available at [http://localhost:7474/]
    20:52:19.925 [main] INFO  org.neo4j.server.CommunityNeoServer - Setting startup timeout to: 120000ms based on -1
    Detected incorrectly shut down database, performing recovery..
    2014-05-31 18:52:23.361+0000 INFO  [API] Successfully started database
    2014-05-31 18:52:23.422+0000 INFO  [API] Starting HTTP on port :7474 with 20 threads available
    2014-05-31 18:52:23.991+0000 INFO  [API] Enabling HTTPS on port :7473
    2014-05-31 18:52:25.543+0000 INFO  [API] Mounted discovery module at [/]
    2014-05-31 18:52:25.646+0000 INFO  [API] Loaded server plugin "CypherPlugin"
    2014-05-31 18:52:25.649+0000 INFO  [API]   GraphDatabaseService.execute_query: execute a query
    2014-05-31 18:52:25.650+0000 INFO  [API] Loaded server plugin "GremlinPlugin"
    2014-05-31 18:52:25.650+0000 INFO  [API]   GraphDatabaseService.execute_script: execute a Gremlin script with 'g' set to the Neo4jGraph and 'results' containing the results. Only results of one object type is supported.
    2014-05-31 18:52:25.651+0000 INFO  [API] Mounted REST API at [/db/data/]
    2014-05-31 18:52:25.658+0000 INFO  [API] Mounted management API at [/db/manage/]
    2014-05-31 18:52:25.828+0000 INFO  [API] Mounted webadmin at [/webadmin]
    2014-05-31 20:52:26.004:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
    2014-05-31 18:52:26.069+0000 INFO  [API] Mounting static content at [/webadmin] from [webadmin-html]
    2014-05-31 20:52:26.191:INFO::jetty-6.1.25
    2014-05-31 20:52:26.434:INFO::NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
    2014-05-31 20:52:29.374:INFO::Started SelectChannelConnector@localhost:7474
    2014-05-31 20:52:30.566:INFO::Started SslSocketConnector@localhost:7473
    2014-05-31 18:52:30.567+0000 INFO  [API] Remote interface ready and available at [http://localhost:7474/]

0 个答案:

没有答案