Neo4j 服务器与嵌入式模式 [英] Neo4j Server vs Embedded mode

查看:19
本文介绍了Neo4j 服务器与嵌入式模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确切地知道neo4j服务器和嵌入式模式的含义.即使我阅读了Neo4j 服务器与嵌入式的帖子.但我无法清楚地了解这些概念.我已经在作为 Neo4j 服务器的 Windows 64 位机器上安装了 neo4j 2.1.1.那么neo4j嵌入模式什么时候出现呢?

I wanted to know exactly what is meant by neo4j server and the embedded mode. Even i gone through the post Neo4j Server vs. Embedded. But i dint get clearly those concepts. I have installed neo4j 2.1.1 on windows 64bit machine which is a neo4j server. So when neo4j embedded mode will come into picture?

另外,我们如何在嵌入式模式和服务器模式之间切换,反之亦然?

Also how can we switch between embedded mode to server mode or vice-versa?

当我使用 mysql 到 neo4j 迁移(使用批量导入)时,在将节点和关系导入到 neo4j 后,在 messages.log 文件中收到一条消息,如下所示:

When i was working with mysql to neo4j migration(using batch-import), after importing the nodes and relationships into neo4j getting a message in a messages.log file as below:

Clean shutdown on BatchInserter(EmbeddedBatchInserter[C:UsersNeo4j	2.db]) 

如果我安装了neo4j服务器,这里的嵌入式显示如何?所以请澄清这些疑问.

How embedded is appearing here if i have installed neo4j server ? So please clarify these queries.

谢谢

推荐答案

嵌入式数据库在您的应用程序内部运行,这意味着它们与您的应用程序在同一个 JVM 中.通常,使用嵌入式数据库,您将进行直接数据库访问或密码查询.这里有很多优点和缺点 - 缺点之一是您的 JVM 进程锁定了数据库;您不能让不同 JVM 中的一堆不同应用程序同时访问同一个嵌入式数据库.亲是直接访问.

Embedded databases run inside of your application, meaning they're in the same JVM as your application. In general, with embedded databases you'll do direct database access or cypher queries. There are a lot of pros and cons here - one of the cons is that your JVM process locks the database; you can't have a bunch of different applications in different JVMs accessing the same embedded database at the same time. The pro is direct access.

当您运行服务器时,通常意味着您正在使用 Web 管理组件,这些组件也提供一组 RESTful 服务.这样做的优点是它在不同的 JVM 中.这意味着您可以更轻松地从其他编程语言、网络等访问它.您可以在许多 JVM 中拥有许多应用程序,所有应用程序都通过 RESTful 服务与服务器实例通信.通常访问速度没有那么快,但更灵活.但是,当您以这种方式运行它时,直接访问 Java 应用程序内部的图形(使用 Neo4J API)是不受限制的.

When you're running a server, usually that means you're using the web admin components which also provide a set of RESTful services. The pro of this is that it's in a different JVM. Meaning you could access it more easily from other programming languages, over the network, and so on. You could have many applications in many JVMs all talking to a server instance via RESTful services. Generally access isn't as fast, but it's more flexible. When you run it this way though, direct access to the graph inside of a java application (using the Neo4J API) is off limits.

如果您想从嵌入式数据库中运行 Web 管理/GUI 内容和 RESTful 服务,您可以这样做.请参阅这些说明了解如何操作.

If you want to run the web admin/GUI stuff and RESTful services from within an embedded database, you can do that. See these instructions for how.

这是一个代码片段:您需要的是WrappingNeoServerBootstrapper.

Here's a code snippet: what you need is the WrappingNeoServerBootstrapper.

AbstractGraphDatabase graphdb = getGraphDb();
WrappingNeoServerBootstrapper srv;
srv = new WrappingNeoServerBootstrapper( graphdb );
srv.start();
// The server is now running
// until we stop it:
srv.stop();

这篇关于Neo4j 服务器与嵌入式模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆