概述
Nebula是一个开源的分布式图数据库系统,专为处理超大规模关联数据而设计。可以将复杂的关联关系存在nebula图数据库中,提供可视化平台用于案件关联查询及调查。测试的前提是了解nebula图数据库,会使用基本的插入语句和查询语句,可参考官方文档
nebula官方文档
基本概念
类型 | 说明 |
---|---|
图空间 (Space) | 图空间用于隔离不同团队或者项目的数据。不同图空间的数据是相互隔离的,可以指定不同的存储副本数、权限、分片等。 |
点(Vertex) | 边是用来连接点的,表示两个点之间的关系或行为 |
标签(Tag) | Tag由一组事先预定义的属性构成。 |
边类型(Edge type) | Edgetype由一组事先预定义的属性构成。 |
属性(Properties) | 属性是指以键值对(Key-value pair)形式存储的信息。 |
架构图
测试指导与案例演示
操作nebula图库两种方式
控制台访问
- 登录控制台,选择空间
客户端访问
- 连接服务器
执行命令连接nebula客户端
/data/nebula360/nebula-console -port 9669 -u root -p nebula
执行命令use super_orion,使用super_orion空间
常用命令
- INSERT VERTEX命令插入点
INSERT VERTEX cust_t (cust_name,mobile_no,email,mac,regist_datetime,cust_org,insert_time) VALUES "168000060971": ("张四", "18276720004","0004@aaa.com", "asdwefcerf344", timestamp(), "SMY", timestamp());
- INSERT EDGE命令插入边
INSERT EDGE mobile_e (create_time,update_time) VALUES "cjy_test_0000003"->"18276720004"@0:(timestamp(),timestamp());
- 查询该点相关联的边和点
match p=(v:cust_t)-[e]->(v2)where id(v)=="140000000094" return v,e,v2;
- 查询二度关联数据
go 1 step from '110000000463' over self_mobile_e ,reserve_mobile_e BIDIRECT where timestamp(properties(edge).update_time) > (timestamp('2025-04-20 17:31:22') - 3600 * 24 * 2 * 365) yield distinct id($$) as id | go 1 step from $-.id over self_mobile_e ,reserve_mobile_e REVERSELY where timestamp(properties(edge).update_time) < (timestamp('2025-04-20 17:31:22')) yield distinct id($$) as cust_no_2_degree, '110000000463' as cust_no, timestamp(properties(edge).update_time) as update_time