JanusGraph入门

一、JanusGraph是什么

  简单来说JanusGraph 就是一个图形数据库,我们都知道传统常用的数据库类型有:

   想了解更多关于数据库相关的知识请参见网站:https://db-engines.com/en/ranking/

  1、关系型数据库如MySQL、Oracle、Db2等

  2、No-SQL数据库,这其中最为代表的就是内存数据库Redis、MemCached这类数据库就是我们传说中的key-value类型的数据库

  3、常用于大数据方向的基于文档结构(Document)类型的数据库,像MongeDB、CouchDB等

  4、再有一种就是我们要说的在知识图谱相关的应用中出现的图数据存储相关的数据库,包括Neo4j、JanusGraph、TigerGraph、HuguGraph等

二、JanusGraph 能做什么

     上节讲过JanusGraph 是图数据库,要想知道JanusGraph能做什么,首先我们要先来回顾一下大学时期的《数据结构》这门课程中关于“图”的定义

   图(graph)它是一种用来描述现实世界中个体和个体之间网络关系的数据结构有如下特点 :                      
      一组顶点:通常用 V (Vertex) 表示顶点的集合
      一组边:通常用 E (Edge) 表示边的集合 
      边是顶点和顶点之间的连线
      边可以是有向的, 也可以是无向的.(比如A --- B, 通常表示无向. A --> B, 通常表示有向)    

 更详细的图 的 存储 和 遍历请参见:https://github.com/raywenderlich/swift-algorithm-club/tree/master/Graph   和 http://blog.chinaunix.net/uid-26548237-id-3483650.html

 什么是图形数据库

  图数据库源起欧拉和图理论,也可称为面向/基于图的数据库,对应的英文是Graph Database。
  图数据库的基本含义是以“图”这种数据结构存储和查询数据,而不是存储图片的数据库。
  它的数据模型主要是以节点和关系(边)来体现,也可处理键值对。它的优点是快速解决复杂的关系问题。
  图形数据库是NoSQL数据库的一种类型,它应用图形理论存储实体之间的关系信息。
  最常见的例子,就是社会网络中人与人之间的关系。关系型数据库用于存储关系型数据的效果并不好,其查询复杂、缓慢、超出预期,而图形数据库的独特设计恰恰弥补了这个缺陷

JanusGraph简介

    JanusGraph是一个可扩展的图数据库,可以把包含数千亿个顶点和边的图存储在多机集群上。它支持事务,支持数千用户实时、并发访问存储在其中的图。(JanusGraph is a scalable graph database optimized for storing and querying graphs containing hundreds of billions of vertices and edges distributed across a multi-machine cluster. JanusGraph is a transactional database that can support thousands of concurrent users executing complex graph traversals in real time.)
我们可以将图数据库系统的应用领域划分成以下两部分: 
   1、用于联机事务图的持久化技术(通常直接实时地从应用程序中访问)。这类技术被称为图数据库,它们和“通常的”关系型数据库世界中的联机事务处理(Online Transactional Processing,OLTP)数据库是一样的。
   2、用于离线图分析的技术(通常都是按照一系列步骤执行)。这类技术被称为图计算引擎。它们可以和其他大数据分析技术看做一类,如数据挖掘和联机分析处理(Online Analytical Processing,OLAP)。 

JanusGraph的发展历史

JanusGraph是2016年12月27日从Titan fork出来的一个分支,之后TiTan的开发团队在2017年陆续发了0.1.0rc1、0.1.0rc2、0.1.1、0.2.0等四个版本,最新的版本是2017年10月12日。
titan是从2012年开始开发,到2016年停止维护的一个分布式图数据库。最初在2012年启动titan项目的公司是Aurelius,2015年此公司被 DataStax(DataStax是开发apache Cassandra 的公司)收购,DataStax公司吸收了TiTan的图存储能力,形成了自己的商业产品DataStax Enterprise Graph。
TiTan开发者们希望把TitTan放到Apache Software Foundation下,不过,DataStax不愿意这样做(可能考虑到要保护自己的商业产品DataStax Enterprise Graph的技术优势吧,其实这点优势是从Titan来的),而且自从2015年9月DataStax收购了Titan的母公司后,TiTan一直处于停滞状态(应该是DataStax收购之后,忙于推出自己的商业产品DataStax Enterprise Graph,忙于整合Titan进自己的商业产品吧,可是Titan本身没有得到发展)。鉴于此,2016年6月,TiTan的开发者们fork了一个TiTan的分支(因为Titan已经属于DataStax了,所以他们必须另外弄一个商标),重命名为JanusGraph,并将其置于Linux Software Foundation下。
2017年4月6日发布了第一个版本0.1.0-rc1,目前最新版本是2017年10月12日发布的0.2.0版。
JanusGraph项目启动的初衷是“通过为其增加新功能、改善性能和扩展性、增加后端存储系统来增强分布式图系统的功能,从而振兴分布式图系统的开发”,JanusGraph从Apahce TinkerPop中吸收了对属性图模型(Property Graph Model)的支持和对属性图模型进行遍历的Gremlin遍历语言。(“reinvigorate development of the distributed graph system to add new functionality, improve performance and scalability, and maintain a variety of storage backends,JanusGraph incorporates support for the property graph model with the open source graph computing framework Apache TinkerPop and its Gremlin graph traversal language”.)

JanusGraph的功能( Benefits)

 JanusGraph的设计目的是支持处理大图,以至于它们需要超出一台机器所能提供的存储和计算能力。缩放图数据处理实时遍历和分析查询是JanusGraph的基本优势。(JanusGraph is designed to support the processing of graphs so large that they require storage and computational capacities beyond what a single machine can provide. Scaling graph data processing for real time traversals and analytical queries is JanusGraph’s foundational benefit)

它可以利用很大的集群,也就可以存储很大的包含数千亿个节点和边的图。由于它又支持实时、数千用户并发遍历图和分析查询图的功能。所以这两个特点是它显著的优势

它支持以下功能:

  (1)分布式部署,因此,支持集群。

  (2)可以存储大图,比如包含数千亿Vertices和edges的图。

  (3)支持数千用户实时、并发访问。(并发访问肯定是实时的,这个唉,没必要强调好像)

  (4)集群节点可以线性扩展,以支持更大的图和更多的并发访问用户。(Elastic and linear scalability for a growing data and user base)

  (5)数据分布式存储,并且每一份数据都有多个副本,因此,有更好的计算性能和容错性。(Data distribution and replication for performance and fault tolerance)

  (6)支持在多个数据中心做高可用,支持热备份。(Elastic and linear scalability for a growing data and user base)

  (7)支持各种后端存储系统,目前标准支持以下四种,当然也可以增加第三方的存储系统:

    • Apache Cassandra®
    • Apache HBase®
    • Google Cloud Bigtable
    • Oracle BerkeleyDB

  (8)通过集成大数据平台,比如Apache Spark、Apache Giraph、Apache Hadoop等,支持全局图数据分析、报表、ETL

  (9)支持geo(Gene Expression Omnibus,基因数据分析)、numeric range(这个的含义不清楚)

  (10) 集成ElasticSearch、Apache Solr、Apache Lucene等系统后,可以支持全文搜索。

  (11) 原生集成Apache TinkerPop图技术栈,包括Gremlin graph query language、Gremlin graph server、Gremin applications。

  (12) 开源,基于Apache 2 Licence。

  (13) 通过使用以下系统可以可视化存储在JanusGraph中的图数据:

    • Cytoscape
    • Gephi plugin for Apache TinkerPop
    • Graphexp
    • KeyLines by Cambridge Intelligence
    • Linkurious

   JanusGraph 体系架构 

    参考资料:

   https://docs.janusgraph.org/latest/arch-overview.html (官网架构)

   https://www.cnblogs.com/zhangzl419/p/9100498.html

  JanusGraph为数据持久性、数据索引和客户机访问实现了健壮的模块化接口。JanusGraph的模块化架构允许它与广泛的存储、索引和客户端技术进行互操作(JanusGraph implements robust, modular interfaces for data persistence, data indexing, and client access. JanusGraph’s modular architecture allows it to interoperate with a wide range of storage, index, and client technologies)

  JanusGraph和磁盘之间有一个或多个存储和索引适配器。JanusGraph提供了以下适配器的标准配置,但是JanusGraph的模块化架构支持第三方适配器。(Between JanusGraph and the disks sits one or more storage and indexing adapters. JanusGraph comes standard with the following adapters, but JanusGraph’s modular architecture supports third-party adapters.)

   像数据存储系统,(当然也可以将第三方的存储系统作为JanusGraph的后端存储系统)

 支持外部所以系统:

应用系统可以有两种方式与JanusGraph交互:

    1、将JanusGraph嵌入到应用程序中,直接对同一JVM中的图形执行Gremlin查询。查询执行、JanusGraph的缓存和事务处理都发生在与应用程序相同的JVM中,而从存储后端检索数据可能是本地的,也可能是远程的(Embed JanusGraph inside the application executing Gremlin queries directly against the graph within the same JVM. Query execution, JanusGraph’s caches, and transaction handling all happen in the same JVM as the application while data retrieval from the storage backend may be local or remote)

   2、通过向服务器提交Gremlin查询,与本地或远程JanusGraph实例进行交互。JanusGraph本身支持Apache TinkerPop堆栈的Gremlin服务器组件。(Interact with a local or remote JanusGraph instance by submitting Gremlin queries to the server. JanusGraph natively supports the Gremlin Server component of the Apache TinkerPop stack.)

   JanusGraph 架构图和上下问(Architecture and Context)

数据处理大致可以分成两大类:。

联机事务处理OLTP(on-line transaction processing):是传统的关系型数据库的主要应用,主要是基本的、日常的事务处理,例如银行交易。

联机分析处理OLAP(On-Line Analytical Processing):是数据仓库系统的主要应用,支持复杂的分析操作,侧重决策支持,并且提供直观易懂的查询结果。

从架构图可以看出,JanusGraph 架构主要包括以下四部分

1、数据存储 :负责JanusGraph图数据的存储

2、外部索引:负责JanusGraph的外部索引

3、OLTP:负责图数据库相关接口及API操作(含Gremlin)

4、OLAP:负责图计算相关接口及与其他计算框架的集成

 

 

   

 

 

   

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值