概述
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