OrientDB基础

特点

  1. 多模数据库,支持NoSQL、graph
    可以使用Neo4j Importer导入neo4j的数据

  2. 性能好,读写操作都很快,每秒存储多达120000条记录

    • 关系是记录见的物理链接;
    • 更好地使用RAM;
    • 以毫秒为单位遍历记录的部分或整个树和图形;
    • 遍历速度不受数据库大小的影响
  3. 多主机架构配置简单
    在主从体系结构中,主服务器常常成为瓶颈。
    使用OrientDB,吞吐量不受单个服务器的限制,全局吞吐量是所有服务器吞吐量的总和,非常适合云计算,数百台服务器可以共享工作负载。

    • 多主机+分片架构
    • 弹性线性可伸缩性
    • 使用WAL恢复数据库内容
  4. 免费
    OrientDB社区免费供商业使用,附带Apache 2开源许可证,无需多个产品和多个许可证。

  5. 从neo4j迁移方便
    使用neo4j导入器可以导入neo4j的图数据

存在问题

  1. schema的定义不能使用中文
  2. 查询指定节点间的关系比较麻烦
    how to check if two verticies are connected with an edge in orient DB using python

安装

可以下载二进制包、源码进行安装,也可以使用docker镜像进行安装。

  1. http://www.orientdb.com/docs/last/admin/installation/

  2. 在ubuntu上安装
    http://www.famvdploeg.com/blog/2013/01/setting-up-an-orientdb-server-on-ubuntu/

  3. docker安装
    http://www.orientdb.com/docs/last/admin/Docker-Home.html

    1. 下载并启动orientdb镜像

      docker run -d --name orientdb -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=root orientdb:2.2  # pyorient不支持3以上版本
      docker logs orientdb
      

      服务已经在容器中启动,无需再进入容器启动服务。

    2. 查看orientdb的启动日志
      可以看到输出

      ......
      2022-09-02 02:49:00:470 INFO  OrientDB Studio available at http://172.17.0.4:2480/studio/index.html [OServer]
      

      在浏览器中输入 http://127.0.0.1:2480,可以看到如下界面:

使用

traverse * from (select from Person where name='小明')
MATCH {class: Disease, as: d, where: (name = '糖尿病')}-HasSympton-> {as:r} RETURN r.name

参考资料

https://www.anycodings.com/1questions/5320694/what-is-the-correctly-way-to-delete-edges-with-orientdb-ogm-in-django-rest-framework
https://www.cnblogs.com/jijizhazha/p/6672601.html
https://orientdb.com/docs/last/pyorient/PyOrient-OGM-Connection.html
https://mlog.club/article/4217746
https://www.yiibai.com/orientdb/orientdb_create_edge.html
https://github.com/mogui/pyorient/issues/274#issuecomment-481025944
https://www.jianshu.com/p/8650488cd6b8
https://blog.csdn.net/zhufengyi/article/details/53037764

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容