前边我们看到的大部分的例子都是用了小精灵控制台,内存中的廷克图在一台机器上运行的。然而有多种方式可以进行图的布署以及进行图的处理。与图交互还是用小精灵查询语言,控制台是可选的,很多种不式远不止在一台机器上完成所有的工作。例如在阿帕奇Tinker pop的包里就包含了一个组件小精灵服务器。小精灵服务器允许您在本地有一个图服务器或者与远端的服务器通赤HTTP或者WebSockets对话。小精灵控制台支持访问本地的图或者远程访问。或者您可以通过您的代码或者其它的工具甚至是curl这样的命令行工具访问它们。
Most of the examples we have looked at so far were produced using the Gremlin console and the
TinkerGraph in-memory graph all running on a single machine. However, there are many ways to
deploy and interact with a graph while still using Gremlin and optionally the Gremlin Console, and
many of them go beyond doing everything on a single machine. The Apache TinkerPop package for
example includes a component called Gremlin Server. Gremlin Server allows you to host a graph
database locally or remotely and talk to it over HTTP or WebSockets. The Gremlin console supports
accessing graphs both locally or remotely or you can access them using your own code or other
tools or even command line utilities such as curl.
对于生产环境来说,您可能会使用类似杰森图这样的技术,它们的后端以HBase,或者Cassandra做支撑,索引的技术会是Solr或者ES。在这些情况下,您的对图的处理,对于图的管理,查询返回的结果会有很大的差异。
For a production environment it is likely you will use a technology such as JanusGraph backed by
something like HBase or Cassandra and an indexing technology such as Solr or Elasticsearch. In
these cases the way you work with and manage the graph and the way that query results are
returned will vary.
在一些情况,从其它的图系统中返回的数据是GraphSON格式的,它就像程序中的变量一样。有时也可以从Python的编辑器中使用小精灵语言来进行图的处理。您可以配置您自己的图系统,或者是您可以使用主机的服务。很可能您可以通过小精灵控制台来连接远程的使用小精灵服务器的图。您可以用curl或者其它的HTTP/REST类型的技术来进行。一旦您超越了基本的,进入到生产系统,那将是一条漫长而迂回的路, 有许多因素需要考虑。
In some cases data returned will be in the form of a GraphSON (JSON) in others it might be as
variables within a program. There are also ways to work with graphs using Gremlin from a Python
Notebook. You might setup your own on-premise graph system or you might use a hosted service.
It’s quite possible you might still wish to connect to a remote graph using Gremlin Server via the
Gremlin Console but you just as likely could use curl or some other HTTP/REST type of technology.
So that is a long winded way of saying that once you move beyond the basics and head towards
putting a system into production, there are a lot of options to consider.
在本节您将会看到选自这些复杂环境中的一些例子。目前为目本书的重点是小精灵查询遍历语言的教学,使用小精灵控制台,廷克图做我们的学习环境。然而如果没有接触到其它的一些环境,您如何去配置它们,为什么您可以使用它们,这将会是我们的学习的疏忽。接下来的各小节是一种尝试,刺激您的食欲,超越小精灵控制台,进入图应用编程和图系统布署世界。
In this section you will find a selection of examples from these more sophisticated environments.
The focus of this book so far has been to teach the Gremlin query and traversal language, using the
Gremlin Console and TinkerGraph as our learning environment. However, it would be remiss to
end our discussion without at least touching on some of these other environments, how you might
configure them and why you might use them. The following sections are an attempt to whet your
appetite for moving beyond the Gremlin Console into the world of graph application programming
and graph system deployment!
浙公网安备 33010602011771号