Nebula:Installation:修订间差异

来自WHY42
Riguz留言 | 贡献
Created page with " <syntaxhighlight lang="bash"> git clone -b release-3.6 https://github.com/vesoft-inc/nebula-docker-compose.git cd nebula-docker-compose docker-compose up -d </syntaxhighlight> Category:Database Category:Nebula"
 
Riguz留言 | 贡献
 
(未显示同一用户的6个中间版本)
第1行: 第1行:
 
= Installation =
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
git clone -b release-3.6 https://github.com/vesoft-inc/nebula-docker-compose.git
git clone -b release-3.6 https://github.com/vesoft-inc/nebula-docker-compose.git
第6行: 第6行:
</syntaxhighlight>
</syntaxhighlight>


= Get Started =
== Connect ==
<syntaxhighlight lang="bash">
docker ps | grep console
docker exec -it c1b6410dba24 sh
nebula-console -u root -p password --address=graphd --port=9669
</syntaxhighlight>
<pre>
/ # nebula-console -u root -p password --address=graphd --port=9669
Welcome!
(root@nebula) [(none)]>
</pre>
== Create space ==
<syntaxhighlight lang="bash">
(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)
</syntaxhighlight>
== Create tags==
<syntaxhighlight lang="bash">
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)
</syntaxhighlight>
== Insert Data==
<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>
== Query ==
<syntaxhighlight lang="bash">
(root@nebula) [basketballplayer]> GO FROM "player101" OVER follow YIELD id($$);
+-------------+
| id($$)      |
+-------------+
| "player100" |
| "player102" |
+-------------+
Got 2 rows (time spent 9.537ms/10.8245ms)
</syntaxhighlight>
[[Category:Database]]
[[Category:Database]]
[[Category:Nebula]]
[[Category:Nebula]]

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

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

(root@nebula) [basketballplayer]> GO FROM "player101" OVER follow YIELD id($$);
+-------------+
| id($$)      |
+-------------+
| "player100" |
| "player102" |
+-------------+
Got 2 rows (time spent 9.537ms/10.8245ms)