首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >[总目录]JanusGraph重要笔记

[总目录]JanusGraph重要笔记

作者头像
陈黎栋
发布2020-02-18 15:08:10
发布2020-02-18 15:08:10
2K0
举报

资料查阅

远程连接JanusGraph Server(即gremlin-server)

JanusGraph数据库配置(官网中文翻译).https://cloud.tencent.com/developer/article/1585613

JanusGraph·server端配置启动和远程remote连接·多实例问题 https://cloud.tencent.com/developer/article/1585216

远程连接方法一

  • Java 操作JanusGraph. http://www.k6k4.com/chapter/show/aafiizxav1531746415578
  • 上文配置改in-memory,即可在应用程序内使用嵌入式Janus写入数据和查询数据
  • 有人说把文中 127.0.01,改远程地址,即可远程写入数据和查询数据,我还没有试验过
  • 不需要写序列化数据的代码

远程连接方法二

  • 官方github的examples,下载这个文件夹,用IDEA下载,其中有多个Maven模块,找到remote模块,其依赖于commons模块
  • <<janusgraph-examples.zip>>
  • 具体的:下图中的RemoteGraphAPP继承自JanusGraphApp,JanusGraphApp继承自GraghApp.java
  • RemoteGraphApp中只有 远程连接 和 打开Graph的逻辑, 创建Schema和其他元素的逻辑由 JanusGraphApp完成 <<janusgraph-examples.zip>> 上面压缩包里的项目从 RemoteGraphApp出运行,可以直接跑通, 服务器端可以查询到数据。
  • 程序运行逻辑:
代码语言:txt
复制
-  RemoteGraphApp的main函数
代码语言:txt
复制
-  RemoteGraphApp的构造函数
代码语言:txt
复制
-  JanusGraphApp的构造函数
代码语言:txt
复制
-  GraphApp的构造函数
代码语言:txt
复制
-  RemoteGraphApp实例调用runApp(),进入GraphApp的runApp();
代码语言:txt
复制
-  RemoteGraphApp的openGraph()
代码语言:txt
复制
    -  client = cluster.connect(); 连接远端服务器
代码语言:txt
复制
    -   graph = Empt  g = graph.tr  return g;
代码语言:txt
复制
- RemoteGraphApp的createSchema() 		
    -  final String req = JanusGraphApp.createSchemaRequest();
代码语言:txt
复制
    -  final ResultSet resultSet = client.submit(req); //客户端提交gremlin的Schema的请求语句,并获得返回结果
代码语言:txt
复制
- RemoteGraphApp.createElements() 		
    - ​
代码语言:txt
复制
- 远程测试结果: 		
    - ​
代码语言:txt
复制
- GraphApp.readElements()//测试读数据
- GraphApp.updateElements() //测试更新数据
- GraphApp.deleteElements() //测试删除一个顶点
- RemoteApp.closeGraph();
- GraphApp.closeGraph();远程服务器,通过bin下面的脚本 janus.sh启动更改remote模块中的配置文件remote-objects.yaml为hosts: 10.158.69.75 port: 8182 serializer: {     className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,     config: {         bufferSize: 8192, useMapperFromGraph: graph,         ioRegistries: org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry,         serializeResultToString: false,         custom: org.janusgraph.graphdb.relations.RelationIdentifier     }
  • 更改commons模块中的的 createSchemaRequest() 里的序列化(字符串)逻辑
    • 该字符串将创建schema、创建具体元素的代码序列化到一句请求字符串中
  • 所以需要写序列化请求内容的代码,此处有些繁琐
  • 验证可用

JanusGraph数据库操作

JanusGraph的schema及数据建模

JanusGraph实战笔记·数据写入·查询. https://cloud.tencent.com/developer/article/1585621

Java in-memory嵌入式创建schema,解析ttl文件,写入Janus并批量查询的代码:

  • 见我的微云同步盘:https://share.weiyun.com/54qS919
  • 可视化插件
    • Graphexp
      • Gremlin官网上的介绍:Graphexp - Interactive visualization of the Gremlin graph database with D3.js.
    • Cytoscape
    • Apache TinkerPop的Gephi插件
    • KeyLines by Cambridge Intelligence
    • Linkurious

JanusGraph·上手JanusGraph

图解JanusGraph内部数据存储结构. https://cloud.tencent.com/developer/news/206999

我的博客即将同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3l3al4ql8ou8o

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 资料查阅
  • 远程连接JanusGraph Server(即gremlin-server)
  • JanusGraph数据库操作
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档