Nebula:Installation:修订间差异

来自WHY42
Riguz留言 | 贡献
Riguz留言 | 贡献
第95行: 第95行:
== Insert Data==
== Insert Data==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
INSERT VERTEX player(name, age) VALUES "player100":("Tim Duncan", 42);
INSERT VERTEX player(name, age) VALUES "player101":("Tony Parker", 36);
INSERT VERTEX player(name, age) VALUES "player102":("LaMarcus Aldridge", 33);
INSERT VERTEX team(name) VALUES "team203":("Trail Blazers"), "team204":("Spurs");
INSERT EDGE follow(degree) VALUES "player101" -> "player100":(95);
INSERT EDGE follow(degree) VALUES "player101" -> "player102":(90);
INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75);
INSERT EDGE serve(start_year, end_year) VALUES "player101" -> "team204":(1999, 2018),"player102" -> "team203":(2006,  2015);


</syntaxhighlight>
</syntaxhighlight>
== Query ==
== Query ==



2023年10月13日 (五) 03:02的版本

Installation

git clone -b release-3.6 https://github.com/vesoft-inc/nebula-docker-compose.git
cd nebula-docker-compose
docker-compose up -d

Get Started

Connect

docker ps | grep console
docker exec -it c1b6410dba24 sh

nebula-console -u root -p password --address=graphd --port=9669
/ # nebula-console -u root -p password --address=graphd --port=9669

Welcome!

(root@nebula) [(none)]>

Create space

(root@nebula) [(none)]> SHOW HOSTS;
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| Host        | Port | Status   | Leader count | Leader distribution  | Partition distribution | Version |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| "storaged0" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.6.0" |
| "storaged1" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.6.0" |
| "storaged2" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.6.0" |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
Got 3 rows (time spent 6.392ms/10.383292ms)
(root@nebula) [(none)]> CREATE SPACE basketballplayer(partition_num=15, replica_factor=1, vid_type=fixed_string(30));
Execution succeeded (time spent 11.969ms/12.891291ms)

Fri, 13 Oct 2023 02:53:56 UTC

(root@nebula) [(none)]> SHOW SPACES;
+--------------------+
| Name               |
+--------------------+
| "basketballplayer" |
+--------------------+
Got 1 rows (time spent 3.14ms/5.527791ms)

(root@nebula) [(none)]> USE basketballplayer;
Execution succeeded (time spent 4.402ms/5.538625ms)

Fri, 13 Oct 2023 02:54:56 UTC

(root@nebula) [basketballplayer]> SHOW HOSTS;
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| Host        | Port | Status   | Leader count | Leader distribution  | Partition distribution | Version |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| "storaged0" | 9779 | "ONLINE" | 5            | "basketballplayer:5" | "basketballplayer:5"   | "3.6.0" |
| "storaged1" | 9779 | "ONLINE" | 5            | "basketballplayer:5" | "basketballplayer:5"   | "3.6.0" |
| "storaged2" | 9779 | "ONLINE" | 5            | "basketballplayer:5" | "basketballplayer:5"   | "3.6.0" |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
Got 3 rows (time spent 2.566ms/3.501ms)

Create tags

CREATE TAG player(name string, age int);
CREATE TAG team(name string);
CREATE EDGE follow(degree int);
CREATE EDGE serve(start_year int, end_year int);

show tags;
+----------+
| Name     |
+----------+
| "player" |
| "team"   |
+----------+
Got 2 rows (time spent 7.586ms/12.390458ms)

Fri, 13 Oct 2023 02:59:50 UTC

(root@nebula) [basketballplayer]> show edges;
+----------+
| Name     |
+----------+
| "follow" |
| "serve"  |
+----------+
Got 2 rows (time spent 2.871ms/4.843209ms)

Insert Data

INSERT VERTEX player(name, age) VALUES "player100":("Tim Duncan", 42);
INSERT VERTEX player(name, age) VALUES "player101":("Tony Parker", 36);
INSERT VERTEX player(name, age) VALUES "player102":("LaMarcus Aldridge", 33);
INSERT VERTEX team(name) VALUES "team203":("Trail Blazers"), "team204":("Spurs");
INSERT EDGE follow(degree) VALUES "player101" -> "player100":(95);
INSERT EDGE follow(degree) VALUES "player101" -> "player102":(90);
INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75);
INSERT EDGE serve(start_year, end_year) VALUES "player101" -> "team204":(1999, 2018),"player102" -> "team203":(2006,  2015);

Query