diff --git a/docs-2.0/1.introduction/3.nebula-graph-architecture/2.meta-service.md b/docs-2.0/1.introduction/3.nebula-graph-architecture/2.meta-service.md index 28dd6041574..9decb33d7ec 100644 --- a/docs-2.0/1.introduction/3.nebula-graph-architecture/2.meta-service.md +++ b/docs-2.0/1.introduction/3.nebula-graph-architecture/2.meta-service.md @@ -45,11 +45,9 @@ The Meta Service stores the schema information. Besides, it performs the additio For more information on Nebula Graph schema, see [Data model](../2.data-model.md). -### Manages TTL-based data eviction +### Manages TTL information -The Meta Service provides automatic data eviction and space reclamation based on TTL (time to live) options for Nebula Graph. - -For more information on TTL, see [TTL options](../../3.ngql-guide/8.clauses-and-options/ttl-options.md). +The Meta Service stores the definition of TTL (Time to Live) options which are used to control data expiration. The Storage Service takes care of the expiring and evicting processes. For more information, see [TTL](../../3.ngql-guide/8.clauses-and-options/ttl-options.md). ### Manages jobs diff --git a/docs-2.0/2.quick-start/4.nebula-graph-crud.md b/docs-2.0/2.quick-start/4.nebula-graph-crud.md index 0695543931a..f6b64c141be 100644 --- a/docs-2.0/2.quick-start/4.nebula-graph-crud.md +++ b/docs-2.0/2.quick-start/4.nebula-graph-crud.md @@ -23,7 +23,7 @@ For more information, see [Data modeling](../1.introduction/2.data-model.md). In this topic, we will use the following dataset to demonstrate basic CRUD operations. -![The demo dataset](https://docs-cdn.nebula-graph.com.cn/docs-2.0/2.quick-start/dataset-for-crud.png) +![The demo dataset](dataset-for-crud.png) ## Check the machine status in the Nebula Graph cluster @@ -41,7 +41,6 @@ nebula> SHOW HOSTS; | "storaged2" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | | "Total" | __EMPTY__ | __EMPTY__ | 0 | __EMPTY__ | __EMPTY__ | +-------------+-----------+-----------+--------------+----------------------+------------------------+ -Got 4 rows (time spent 1061/2251 us) ``` From the **Status** column of the table in the return results, you can see that all the Storage services are online. @@ -110,7 +109,6 @@ To make sure the follow-up operations work as expected, take one of the followin ```ngql nebula> CREATE SPACE basketballplayer(partition_num=15, replica_factor=1, vid_type=fixed_string(30)); - Execution succeeded (time spent 2817/3280 us) ``` 2. Check the partition distribution with `SHOW HOSTS` to make sure that the partitions are distributed in a balanced way. @@ -125,7 +123,6 @@ To make sure the follow-up operations work as expected, take one of the followin | "storaged2" | 9779 | "ONLINE" | 5 | "basketballplayer:5" | "basketballplayer:5" | | "Total" | | | 15 | "basketballplayer:15" | "basketballplayer:15" | +-------------+-----------+-----------+--------------+----------------------------------+------------------------+ - Got 4 rows (time spent 1633/2867 us) ``` If the **Leader distribution** is uneven, use `BALANCE LEADER` to redistribute the partitions. For more information, see [BALANCE](../8.service-tuning/load-balance.md). @@ -134,7 +131,6 @@ To make sure the follow-up operations work as expected, take one of the followin ```ngql nebula[(none)]> USE basketballplayer; - Execution succeeded (time spent 1229/2318 us) ``` You can use `SHOW SPACES` to check the graph space you created. @@ -146,7 +142,6 @@ To make sure the follow-up operations work as expected, take one of the followin +--------------------+ | "basketballplayer" | +--------------------+ - Got 1 rows (time spent 977/2000 us) ``` ## Create tags and edge types @@ -174,16 +169,12 @@ Create tags `player` and `team`, edge types `follow` and `serve`. Descriptions a ```ngql nebula> CREATE TAG player(name string, age int); -Execution succeeded (time spent 20708/22071 us) nebula> CREATE TAG team(name string); -Execution succeeded (time spent 5643/6810 us) nebula> CREATE EDGE follow(degree int); -Execution succeeded (time spent 12665/13934 us) nebula> CREATE EDGE serve(start_year int, end_year int); -Execution succeeded (time spent 5858/6870 us) ``` ## Insert vertices and edges @@ -219,32 +210,24 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi ```ngql nebula> INSERT VERTEX player(name, age) VALUES "player100":("Tim Duncan", 42); - Execution succeeded (time spent 28196/30896 us) - + nebula> INSERT VERTEX player(name, age) VALUES "player101":("Tony Parker", 36); - Execution succeeded (time spent 2708/3834 us) - + nebula> INSERT VERTEX player(name, age) VALUES "player102":("LaMarcus Aldridge", 33); - Execution succeeded (time spent 1945/3294 us) - - nebula> INSERT VERTEX team(name) VALUES "team200":("Warriors"), "team201":("Nuggets"); - Execution succeeded (time spent 2269/3310 us) + + nebula> INSERT VERTEX team(name) VALUES "team203":("Trail Blazers"), "team204":("Spurs"); ``` * Insert edges representing the relations between basketball players and teams: ```ngql - nebula> INSERT EDGE follow(degree) VALUES "player100" -> "player101":(95); - Execution succeeded (time spent 3362/4542 us) - - nebula> INSERT EDGE follow(degree) VALUES "player100" -> "player102":(90); - Execution succeeded (time spent 2974/4274 us) - - nebula> INSERT EDGE follow(degree) VALUES "player102" -> "player101":(75); - Execution succeeded (time spent 1891/3096 us) - - nebula> INSERT EDGE serve(start_year, end_year) VALUES "player100" -> "team200":(1997, 2016), "player101" -> "team201":(1999, 2018); - Execution succeeded (time spent 6064/7104 us) + nebula> INSERT EDGE follow(degree) VALUES "player101" -> "player100":(95); + + nebula> INSERT EDGE follow(degree) VALUES "player101" -> "player102":(90); + + nebula> INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75); + + nebula> INSERT EDGE serve(start_year, end_year) VALUES "player101" -> "team204":(1999, 2018),"player102" -> "team203":(2006, 2015); ``` ## Read data @@ -305,30 +288,28 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi ### Examples of `GO` statement -* Search for the players that the player with VID `player100` follows. +* Search for the players that the player with VID `player101` follows. ```ngql - nebula> GO FROM "player100" OVER follow; + nebula> GO FROM "player101" OVER follow; +-------------+ | follow._dst | +-------------+ - | "player101" | + | "player100" | | "player102" | +-------------+ - Got 2 rows (time spent 12097/14220 us) ``` -* Filter the players that the player with VID `player100` follows whose age is equal to or greater than 35. Rename the corresponding columns in the results with `Teammate` and `Age`. +* Filter the players that the player with VID `player101` follows whose age is equal to or greater than 35. Rename the corresponding columns in the results with `Teammate` and `Age`. ```ngql - nebula> GO FROM "player100" OVER follow WHERE properties($$).age >= 35 \ + nebula> GO FROM "player101" OVER follow WHERE properties($$).age >= 35 \ YIELD properties($$).name AS Teammate, properties($$).age AS Age; - +-----------------+-----+ - | Teammate | Age | - +-----------------+-----+ - | "Tony Parker" | 36 | - | "Manu Ginobili" | 41 | - +-----------------+-----+ + +--------------+-----+ + | Teammate | Age | + +--------------+-----+ + | "Tim Duncan" | 42 | + +--------------+-----+ ``` | Clause/Sign | Description | @@ -337,21 +318,19 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi | `$$` | Represents the target vertices. | | `\` | A line-breaker. | -* Search for the players that the player with VID `player100` follows. Then Retrieve the teams of the players that the player with VID `player100` follows. To combine the two queries, use a pipe or a temporary variable. +* Search for the players that the player with VID `player101` follows. Then Retrieve the teams of the players that the player with VID `player100` follows. To combine the two queries, use a pipe or a temporary variable. * With a pipe: ```ngql - nebula> GO FROM "player100" OVER follow YIELD dst(edge) AS id | \ + nebula> GO FROM "player101" OVER follow YIELD dst(edge) AS id | \ GO FROM $-.id OVER serve YIELD properties($$).name AS Team, \ properties($^).name AS Player; - +-----------+-----------------+ - | Team | Player | - +-----------+-----------------+ - | "Spurs" | "Tony Parker" | - | "Hornets" | "Tony Parker" | - | "Spurs" | "Manu Ginobili" | - +-----------+-----------------+ + +-----------------+---------------------+ + | Team | Player | + +-----------------+---------------------+ + | "Trail Blazers" | "LaMarcus Aldridge" | + +-----------------+---------------------+ ``` |Clause/Sign|Description| @@ -367,16 +346,14 @@ Users can use the `INSERT` statement to insert vertices or edges based on existi Once a composite statement is submitted to the server as a whole, the life cycle of the temporary variables in the statement ends. ```ngql - nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \ + nebula> $var = GO FROM "player101" OVER follow YIELD dst(edge) AS id; \ GO FROM $var.id OVER serve YIELD properties($$).name AS Team, \ properties($^).name AS Player; - +-----------+-----------------+ - | Team | Player | - +-----------+-----------------+ - | "Spurs" | "Tony Parker" | - | "Hornets" | "Tony Parker" | - | "Spurs" | "Manu Ginobili" | - +-----------+-----------------+ + +-----------------+---------------------+ + | Team | Player | + +-----------------+---------------------+ + | "Trail Blazers" | "LaMarcus Aldridge" | + +-----------------+---------------------+ ``` ### Example of `FETCH` statement @@ -435,7 +412,6 @@ Users can use the `UPDATE` or the `UPSERT` statements to update existing data. ```ngql nebula> UPDATE VERTEX "player100" SET player.name = "Tim"; - Execution succeeded (time spent 3483/3914 us) nebula> FETCH PROP ON player "player100"; +---------------------------------------------+ @@ -443,41 +419,34 @@ Users can use the `UPDATE` or the `UPSERT` statements to update existing data. +---------------------------------------------+ | ("player100" :player{age: 42, name: "Tim"}) | +---------------------------------------------+ - Got 1 rows (time spent 2463/3042 us) ``` * `UPDATE` the `degree` property of an edge and check the result with the `FETCH` statement. ```ngql - nebula> UPDATE EDGE "player100" -> "player101" OF follow SET degree = 96; - Execution succeeded (time spent 3932/4432 us) + nebula> UPDATE EDGE "player101" -> "player100" OF follow SET degree = 96; - nebula> FETCH PROP ON follow "player100" -> "player101"; + nebula> FETCH PROP ON follow "player101" -> "player100"; +----------------------------------------------------+ | edges_ | +----------------------------------------------------+ - | [:follow "player100"->"player101" @0 {degree: 96}] | + | [:follow "player101"->"player100" @0 {degree: 96}] | +----------------------------------------------------+ - Got 1 rows (time spent 2205/2800 us) ``` * Insert a vertex with VID `player111` and `UPSERT` it. ```ngql - nebula> INSERT VERTEX player(name, age) VALUES "player111":("Ben Simmons", 22); - Execution succeeded (time spent 2115/2900 us) - - Wed, 21 Oct 2020 11:11:50 UTC - - nebula> UPSERT VERTEX "player111" SET player.name = "Dwight Howard", player.age = $^.player.age + 11 \ - WHEN $^.player.name == "Ben Simmons" AND $^.player.age > 20 \ + nebula> INSERT VERTEX player(name,age) values "player111":("David West", 38); + + nebula> UPSERT VERTEX "player111" SET player.name = "David", player.age = $^.player.age + 11 \ + WHEN $^.player.name == "David West" AND $^.player.age > 20 \ YIELD $^.player.name AS Name, $^.player.age AS Age; - +---------------+-----+ - | Name | Age | - +---------------+-----+ - | Dwight Howard | 33 | - +---------------+-----+ - Got 1 rows (time spent 1815/2329 us) + +---------+-----+ + | Name | Age | + +---------+-----+ + | "David" | 49 | + +---------+-----+ ``` ## Delete vertices and edges @@ -502,15 +471,13 @@ Users can use the `UPDATE` or the `UPSERT` statements to update existing data. * Delete vertices: ```ngql - nebula> DELETE VERTEX "team1", "team2"; - Execution succeeded (time spent 4337/4782 us) + nebula> DELETE VERTEX "player111", "team203"; ``` * Delete edges: ```ngql - nebula> DELETE EDGE follow "team1" -> "team2"; - Execution succeeded (time spent 3700/4101 us) + nebula> DELETE EDGE follow "player101" -> "team204"; ``` ## About indexes @@ -538,15 +505,6 @@ Users can add indexes to tags and edge types with the [CREATE INDEX](../3.ngql-g REBUILD {TAG | EDGE} INDEX ; ``` -### Examples - -Create and rebuild indexes for the `name` property on all vertices with the tag `player`. - -```ngql -nebula> CREATE TAG INDEX player_index_0 on player(name(20)); -nebula> REBUILD TAG INDEX player_index_0; -``` - !!! note Define the index length when creating an index for a variable-length property. In UTF-8 encoding, a non-ascii character occupies 3 bytes. You should set an appropriate index length according to the variable-length property. For example, the index should be 30 bytes for 10 non-ascii characters. For more information, see [CREATE INDEX](../3.ngql-guide/14.native-index-statements/1.create-native-index.md) @@ -557,17 +515,16 @@ Make sure there is an [index](#about_indexes) for `LOOKUP` or `MATCH` to use. If Find the information of the vertex with the tag `player` and its value of the `name` property is `Tony Parker`. -This example creates the index `player_name_0` on the player name property. +This example creates the index `player_index_1` on the player name property. ```nGQL -nebula> CREATE TAG INDEX player_name_0 on player(name(10)); -Execution succeeded (time spent 3465/4150 us) +nebula> CREATE TAG INDEX player_index_1 ON player(name(20)); ``` This example rebuilds the index to make sure it takes effect on pre-existing data. ```nGQL -nebula> REBUILD TAG INDEX player_name_0 +nebula> REBUILD TAG INDEX player_index_1 +------------+ | New Job Id | +------------+ @@ -580,12 +537,12 @@ This example uses the `LOOKUP` statement to retrieve the vertex property. ```nGQL nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \ - YIELD player.name, player.age; -+-------------+---------------+------------+ -| VertexID | player.name | player.age | -+-------------+---------------+------------+ -| "player101" | "Tony Parker" | 36 | -+-------------+---------------+------------+ + YIELD properties(vertex).name AS name, properties(vertex).age AS age; ++-------------+---------------+-----+ +| VertexID | name | age | ++-------------+---------------+-----+ +| "player101" | "Tony Parker" | 36 | ++-------------+---------------+-----+ ``` This example uses the `MATCH` statement to retrieve the vertex property. @@ -597,5 +554,4 @@ nebula> MATCH (v:player{name:"Tony Parker"}) RETURN v; +-----------------------------------------------------+ | ("player101" :player{age: 36, name: "Tony Parker"}) | +-----------------------------------------------------+ -Got 1 rows (time spent 5132/6246 us) ``` diff --git a/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md new file mode 100644 index 00000000000..69934b593f1 --- /dev/null +++ b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md @@ -0,0 +1,513 @@ +# nGQL cheatsheet + +## Functions + +- [Math functions](../3.ngql-guide/6.functions-and-expressions/1.math.md) + + | Function | Description | + | :-------------------------------------- | :----------------------------------------------------------- | + | double abs(double x) | Returns the absolute value of the argument. | + | double floor(double x) | Returns the largest integer value smaller than or equal to the argument. (Rounds down) | + | double ceil(double x) | Returns the smallest integer greater than or equal to the argument. (Rounds up) | + | double round(double x) | Returns the integer value nearest to the argument. Returns a number farther away from 0 if the argument is in the middle. | + | double sqrt(double x) | Returns the square root of the argument. | + | double cbrt(double x) | sReturns the cubic root of the argument. | + | double hypot(double x, double y) | Returns the hypotenuse of a right-angled triangle. | + | double pow(double x, double y) | Returns the result of $x^y$. | + | double exp(double x) | Returns the result of $e^x$. | + | double exp2(double x) | Returns the result of $2^x$. | + | double log(double x) | Returns the base-e logarithm of the argument. | + | double log2(double x) | Returns the base-2 logarithm of the argument. | + | double log10(double x) | Returns the base-10 logarithm of the argument. | + | double sin(double x) | Returns the sine of the argument. | + | double asin(double x) | Returns the inverse sine of the argument. | + | double cos(double x) | Returns the cosine of the argument. | + | double acos(double x) | Returns the inverse cosine of the argument. | + | double tan(double x) | Returns the tangent of the argument. | + | double atan(double x) | Returns the inverse tangent of the argument. | + | double rand() | Returns a random floating point number in the range from 0 (inclusive) to 1 (exclusive); i.e.[0,1). | + | int rand32(int min, int max) | Returns a random 32-bit integer in `[min, max)`.
If you set only one argument, it is parsed as `max` and `min` is `0` by default.
If you set no argument, the system returns a random signed 32-bit integer. | + | int rand64(int min, int max) | Returns a random 64-bit integer in `[min, max)`.
If you set only one argument, it is parsed as `max` and `min` is `0` by default.
If you set no argument, the system returns a random signed 64-bit integer. | + | collect() | Puts all the collected values into a list. | + | avg() | Returns the average value of the argument. | + | count() | Returns the number of records. | + | max() | Returns the maximum value. | + | min() | Returns the minimum value. | + | std() | Returns the population standard deviation. | + | sum() | Returns the sum value. | + | bit_and() | Bitwise AND. | + | bit_or() | Bitwise OR. | + | bit_xor() | Bitwise XOR. | + | int size() | Returns the number of elements in a list or a map. | + | int range(int start, int end, int step) | Returns a list of integers from `[start,end]` in the specified steps. `step` is 1 by default. | + | int sign(double x) | Returns the signum of the given number.
If the number is 0, the system returns 0.
If the number is negative, the system returns -1.
If the number is positive, the system returns 1. | + | double e() | Returns the base of the natural logarithm, e (2.718281828459045). | + | double pi() | Returns the mathematical constant pi (3.141592653589793). | + | double radians() | Converts degrees to radians. `radians(180)` returns `3.141592653589793`. | + + + +- [String functions](../3.ngql-guide/6.functions-and-expressions/2.string.md) + + Function| Description | + ---- | ----| + int strcasecmp(string a, string b) | Compares string a and b without case sensitivity. When a = b, the return value is 0. When a > b, the return value is greater than 0. When a < b, the return value is less than 0. | + string lower(string a) | Returns the argument in lowercase. | + string toLower(string a) | The same as `lower()`. | + string upper(string a) | Returns the argument in uppercase. | + string toUpper(string a) | The same as `upper()`. | + int length(string a) | Returns the length of the given string in bytes. | + string trim(string a) | Removes leading and trailing spaces. | + string ltrim(string a) | Removes leading spaces. | + string rtrim(string a) | Removes trailing spaces. | + string left(string a, int count) | Returns a substring consisting of `count` characters from the left side of string a. If string a is shorter than `count`, the system returns string a. | + string right(string a, int count) | Returns a substring consisting of `count` characters from the right side of string a. If string a is shorter than `count`, the system returns string a. | + string lpad(string a, int size, string letters) | Left-pads string a with string `letters` and returns a substring with the length of `size`. | + string rpad(string a, int size, string letters)| Right-pads string a with string `letters` and returns a substring with the length of `size`. | + string substr(string a, int pos, int count) | Returns a substring extracting `count` characters starting from the specified position `pos` of string a. | + string substring(string a, int pos, int count) | The same as `substr()`. | + string reverse(string) | Returns a string in reverse order. + string replace(string a, string b, string c) | Replaces string b in string a with string c. | + list split(string a, string b) | Splits string a at string b and returns a list of strings. | + string toString() | Takes in any data type and converts it into a string. | + int hash() | Takes in any data type and encodes it into a hash value. | | + + + +* [Data and time functions](../3.ngql-guide/6.functions-and-expressions/3.date-and-time.md) + + Function| Description | + ---- | ----| + int now() | Returns the current date and time of the system time zone. | + timestamp timestamp() | Returns the current date and time of the system time zone. | + date date() | Returns the current UTC date based on the current system. | + time time() | Returns the current UTC time based on the current system. | + datetime datetime() | Returns the current UTC date and time based on the current system. | + + + +* [Schema functions](../3.ngql-guide/6.functions-and-expressions/4.schema.md) + + |Function| Description | + |---- | ----| + |id(vertex) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID.| + |map properties(vertex) | Returns the properties of a vertex.| + |map properties(edge) | Returns the properties of an edge.| + |string type(edge) | Returns the edge type of an edge.| + |src(edge)|Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID.| + |dst(edge)|Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID.| + |int rank(edge) | Returns the rank value of an edge.| + + + +* [List functions](../3.ngql-guide/6.functions-and-expressions/6.list.md) + + | Function| Description | + | ---- | ----| + | keys(expr) | Returns a list containing the string representations for all the property names of vertices, edges, or maps. | + | labels(vertex) | Returns the list containing all the tags of a vertex. | + | nodes(path) | Returns the list containing all the vertices in a path. | + | range(start, end [, step]) | Returns the list containing all the fixed-length steps in `[start,end]`. `step` is 1 by default. | + | relationships(path) | Returns the list containing all the relationships in a path. | + | reverse(list) | Returns the list reversing the order of all elements in the original list. | + | tail(list) | Returns all the elements of the original list, excluding the first one. | + | head(list) | Returns the first element of a list. | + | last(list) | Returns the last element of a list. | + | coalesce(list) | Returns the first not null value in a list. | + | reduce() | See [reduce() function](../3.ngql-guide/6.functions-and-expressions/11.reduce.md)。 | + + + +* [count() function](../3.ngql-guide/6.functions-and-expressions/7.count.md) + + | Function| Description | + | :------ | :------------------------------------------------------ | + | count() |Syntax: `count({expr | *})` .
`count()`returns the number of rows (including NULL).
`count(expr)`returns the number of non-NULL values that meet the expression.
count() and size() are different. | + + + +* [collect() function](../3.ngql-guide/6.functions-and-expressions/10.collect.md) + + | Function| Description | + | :-------- | :----------------------------------------------------------- | + | collect() |The collect() function returns a list containing the values returned by an expression. Using this function aggregates data by merging multiple records or values into a single list. | + + + +* [reduce() function](../3.ngql-guide/6.functions-and-expressions/11.reduce.md) + + | Function | Syntax | Description | + | :------- | :-------------------------------------------------------- | ------------------------------------------------------------ | + | reduce() | `reduce( = , IN | )` | The `reduce()` function applies an expression to each element in a list one by one, chains the result to the next iteration by taking it as the initial value, and returns the final result. | + + + +* [hash() function](../3.ngql-guide/6.functions-and-expressions/12.hash.md) + + | Function| Description | + | :----- | :----------------------------------------------------------- | + | hash() | The `hash()` function returns the hash value of the argument. The argument can be a number, a string, a list, a boolean, null, or an expression that evaluates to a value of the preceding data types. The source code of the `hash()` function (MurmurHash2), seed (`0xc70f6907UL`), and other parameters can be found in [`MurmurHash2.h`](https://github.com/vesoft-inc/nebula/blob/master/src/common/base/MurmurHash2.h). | + + + +* [concat() function](../3.ngql-guide/6.functions-and-expressions/13.concat.md) + + | Function| Description | + | :------- | :----------------------------------------------------------- | + | concat() | The `concat()` function requires at least two or more strings. All the parameters are concatenated into one string.
Syntax: `concat(string1,string2,...)` | + + + +* [concat_ws() function](../3.ngql-guide/6.functions-and-expressions/13.concat.md) + + | Function| Description | + | ----------- | ------------------------------------------------------------ | + | concat_ws() | The `concat_ws()` function connects two or more strings with a predefined separator. | + + + +* [Predicate functions](../3.ngql-guide/6.functions-and-expressions/8.predicate.md) + + Predicate functions return `true` or `false`. They are most commonly used in `WHERE` clauses. + + ``` + ( IN WHERE ) + ``` + + | Functions | Description | + |:----- | :------------------: | + | exists() | Returns `true` if the specified property exists in the vertex, edge or map. Otherwise, returns `false`. | + | any() | Returns `true` if the specified predicate holds for at least one element in the given list. Otherwise, returns `false`. | + | all() | Returns `true` if the specified predicate holds for all elements in the given list. Otherwise, returns `false`. | + | none() | Returns `true` if the specified predicate holds for no element in the given list. Otherwise, returns `false`. | + | single() | Returns `true` if the specified predicate holds for exactly one of the elements in the given list. Otherwise, returns `false`. | + + + +* [CASE expressions](../3.ngql-guide/6.functions-and-expressions/5.case-expressions.md) + + The `CASE` expression uses conditions to filter the result of an nGQL query statement. It is usually used in the `YIELD` and `RETURN` clauses. The `CASE` expression will traverse all the conditions. When the first condition is met, the `CASE` expression stops reading the conditions and returns the result. If no conditions are met, it returns the result in the `ELSE` clause. If there is no `ELSE` clause and no conditions are met, it returns `NULL`. + + Syntax: + + ``` + CASE + WHEN THEN + [WHEN ...] + [ELSE ] + END + ``` + +|Parameter|Description| +|-|-| +|`comparer`|A value or a valid expression that outputs a value. This value is used to compare with the `value`.| +|`value`|It will be compared with the `comparer`. If the `value` matches the `comparer`, then this condition is met.| +|`result`|The `result` is returned by the `CASE` expression if the `value` matches the `comparer`.| +|`default`|The `default` is returned by the `CASE` expression if no conditions are met.| + + + +## General queries statements + +* [MATCH](../3.ngql-guide/7.general-query-statements/2.match.md) + + ``` + MATCH [] RETURN + ``` + + | Pattern | Example | Description | + | --------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | + | Match vertices | `(v)` | You can use a user-defined variable in a pair of parentheses to represent a vertex in a pattern. For example: `(v)`. | + | Match tags | `MATCH (v:player) RETURN v` | You can specify a tag with `:` after the vertex in a pattern. | + | Match vertex properties | `MATCH (v:player{name:"Tim Duncan"}) RETURN v` | You can specify a vertex property with `{: }` after the tag in a pattern. | + | Match a VID. | `MATCH (v) WHERE id(v) == 'player101' RETURN v` | You can use the VID to match a vertex. The `id()` function can retrieve the VID of a vertex. | + | Match multiple VIDs. | `MATCH (v:player { name: 'Tim Duncan' })--(v2) WHERE id(v2) IN ["player101", "player102"] RETURN v2` | To match multiple VIDs, use `WHERE id(v) IN [vid_list]`. | + | Match connected vertices | `MATCH (v:player{name:"Tim Duncan"})--(v2) RETURN v2.name AS Name` | You can use the `--` symbol to represent edges of both directions and match vertices connected by these edges. You can add a `>` or `<` to the `--` symbol to specify the direction of an edge. | + | Match paths | `MATCH p=(v:player{name:"Tim Duncan"})-->(v2) RETURN p` | Connected vertices and edges form a path. You can use a user-defined variable to name a path as follows. | + | Match edges | `MATCH (v:player{name:"Tim Duncan"})-[e]-(v2) RETURN e` | Besides using `--`, `-->`, or `<--` to indicate a nameless edge, you can use a user-defined variable in a pair of square brackets to represent a named edge. For example: `-[e]-`. | + | Match an edge type | `MATCH ()-[e:follow]-() RETURN e` |Just like vertices, you can specify an edge type with `:` in a pattern. For example: `-[e:follow]-`. | + | Match edge type properties | ` MATCH (v:player{name:"Tim Duncan"})-[e:follow{degree:95}]->(v2) RETURN e` | You can specify edge type properties with `{: }` in a pattern. For example: `[e:follow{likeness:95}]`. | + | Match multiple edge types | `MATCH (v:player{name:"Tim Duncan"})-[e:follow | :serve]->(v2) RETURN e` | The `|` symbol can help matching multiple edge types. For example: `[e:follow|:serve]`. The English colon (:) before the first edge type cannot be omitted, but the English colon before the subsequent edge type can be omitted, such as `[e:follow|serve]`. | + | Match multiple edges | `MATCH (v:player{name:"Tim Duncan"})-[]->(v2)<-[e:serve]-(v3) RETURN v2, v3` | You can extend a pattern to match multiple edges in a path. | + | Match fixed-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) RETURN DISTINCT v2 AS Friends` | You can use the `:*` pattern to match a fixed-length path. `hop` must be a non-negative integer. The data type of `e` is the list.| + | Match variable-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) RETURN v2 AS Friends` | `minHop`: Optional. It represents the minimum length of the path. `minHop`: must be a non-negative integer. The default value is 1.
`maxHop`: Required. It represents the maximum length of the path. `maxHop` must be a non-negative integer. It has no default value. The data type of `e` is the list.| + | Match variable-length paths with multiple edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow | serve*2]->(v2) RETURN DISTINCT v2` | You can specify multiple edge types in a fixed-length or variable-length pattern. In this case, `hop`, `minHop`, and `maxHop` take effect on all edge types. The data type of `e` is the list.| + | Retrieve vertex or edge information | `MATCH (v:player{name:"Tim Duncan"}) RETURN v`
`MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) RETURN e` | Use `RETURN { | }` to retrieve all the information of a vertex or an edge. | + | Retrieve VIDs | `MATCH (v:player{name:"Tim Duncan"}) RETURN id(v)` | Use the `id()` function to retrieve VIDs. | + | Retrieve tags | `MATCH (v:player{name:"Tim Duncan"}) RETURN labels(v)` | Use the `labels()` function to retrieve the list of tags on a vertex.
To retrieve the nth element in the `labels(v)` list, use `labels(v)[n-1]`. | + | Retrieve a single property on a vertex or an edge | `MATCH (v:player{name:"Tim Duncan"}) RETURN v.age` | Use `RETURN { | }.` to retrieve a single property.
Use `AS` to specify an alias for a property. | + | Retrieve all properties on a vertex or an edge | `MATCH p=(v:player{name:"Tim Duncan"})-[]->(v2) RETURN properties(v2)` | Use the `properties()` function to retrieve all properties on a vertex or an edge. | + | Retrieve edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e]->() RETURN DISTINCT type(e)` | Use the `type()` function to retrieve the matched edge types. | + | Retrieve paths | `MATCH p=(v:player{name:"Tim Duncan"})-[*3]->() RETURN p` | Use `RETURN ` to retrieve all the information of the matched paths. | + | Retrieve vertices in a path | `MATCH p=(v:player{name:"Tim Duncan"})-[]->(v2) RETURN nodes(p)` | Use the `nodes()` function to retrieve all vertices in a path. | + | Retrieve edges in a path | `MATCH p=(v:player{name:"Tim Duncan"})-[]->(v2) RETURN relationships(p)` | Use the `relationships()` function to retrieve all edges in a path. | + | Retrieve path length | `MATCH p=(v:player{name:"Tim Duncan">})-[*..2]->(v2) RETURN p AS Paths, length(p) AS Length` | Use the `length()` function to retrieve the length of a path. | + + + +* [LOOKUP](../3.ngql-guide/7.general-query-statements/5.lookup.md) + + ``` + LOOKUP ON { | } + [WHERE [AND ...]] + [YIELD [AS ]] + ``` + + | Pattern | Example | Description | + | ------------------- | ------------------------------------------------------------ | ---------------------------------------------- | + | Retrieve vertices | `LOOKUP ON player WHERE player.name == "Tony Parker" YIELD player.name AS name, player.age AS age` | The following example returns vertices whose `name` is `Tony Parker` and the tag is `player`. | + | Retrieve edges | `LOOKUP ON follow WHERE follow.degree == 90 YIELD follow.degree` | Returns edges whose `degree` is `90` and the edge type is `follow`. | + | List vertices with a tag | `LOOKUP ON player` | Shows how to retrieve the VID of all vertices tagged with `player`. | + | List edges with an edge types | `LOOKUP ON like` | Shows how to retrieve the source Vertex IDs, destination vertex IDs, and ranks of all edges of the `like` edge type. | + | Count the numbers of vertices or edges | `LOOKUP ON player | YIELD COUNT(*) AS Player_Number` | Shows how to count the number of vertices tagged with `player`. | + | Count the numbers of edges | `LOOKUP ON like | YIELD COUNT(*) AS Like_Number` | Shows how to count the number of edges of the `like` edge type. | + + + +* [GO](../3.ngql-guide/7.general-query-statements/3.go.md) + + ``` + GO [[ TO] STEPS ] FROM + OVER [{REVERSELY | BIDIRECT}] + [ WHERE ] + [YIELD [DISTINCT] ] + [| GROUP BY {col_name | expr | position} YIELD ] + [| ORDER BY [{ASC | DESC}]] + [| LIMIT [,] ] + ``` + + | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------------- | + | `GO FROM "player102" OVER serve` | Returns the teams that player 102 serves. | + | `GO 2 STEPS FROM "player102" OVER follow` | Returns the friends of player 102 with 2 hops. | + | `GO FROM "player100", "player102" OVER serve WHERE properties(edge).start_year > 1995 YIELD DISTINCT properties($$).name AS team_name, properties(edge).start_year AS start_year, properties($^).name AS player_name` | Adds a filter for the traversal. | + | `GO FROM "player100" OVER follow, serve YIELD properties(edge).degree, properties(edge).start_year` | The following example traverses along with multiple edge types. If there is no value for a property, the output is `UNKNOWN_PROP`. | + | `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS destination` | The following example returns the neighbor vertices in the incoming direction of player 100. | + | `GO FROM "player100" OVER follow REVERSELY YIELD src(edge) AS id | GO FROM $-.id OVER serve WHERE properties($^).age > 20 YIELD properties($^).name AS FriendOf, properties($$).name AS Team` | The following example retrieves the friends of player 100 and the teams that they serve. | + | `GO FROM "player102" OVER follow YIELD dst(edge) AS both` | The following example returns all the neighbor vertices of player 102. | + | `GO 2 STEPS FROM "player100" OVER follow YIELD src(edge) AS src, dst(edge) AS dst, properties($$).age AS age | GROUP BY $-.dst YIELD $-.dst AS dst, collect_set($-.src) AS src, collect($-.age) AS age` | The following example the outputs according to age. | + + + +* [FETCH](../3.ngql-guide/7.general-query-statements/4.fetch.md) + + ``` + FETCH PROP ON {[, tag_name ...] | *} + [, vid ...] + [YIELD [AS ]] + ``` + + | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------------------ | + | `FETCH PROP ON player "player100"` | Specify a tag in the `FETCH` statement to fetch the vertex properties by that tag. | + | `FETCH PROP ON player "player100" YIELD player.name AS name` | Use a `YIELD` clause to specify the properties to be returned. | + | `FETCH PROP ON player "player101", "player102", "player103"` | Specify multiple VIDs (vertex IDs) to fetch properties of multiple vertices. Separate the VIDs with commas. | + | `FETCH PROP ON player, t1 "player100", "player103"` | Specify multiple tags in the `FETCH` statement to fetch the vertex properties by the tags. Separate the tags with commas. | + | `FETCH PROP ON * "player100", "player106", "team200"` | Set an asterisk symbol `*` to fetch properties by all tags in the current graph space. | + | `FETCH PROP ON serve "player102" -> "player106" YIELD dst(edge)` | Syntax: `FETCH PROP ON -> [@] [, -> ...] [YIELD ]` | + | `FETCH PROP ON serve "player100" -> "team204"` | The following statement fetches all the properties of the `serve` edge that connects vertex `"player100"` and vertex `"team204"`. | + | `FETCH PROP ON serve "player100" -> "team204" YIELD serve.start_year` | Use a `YIELD` clause to fetch specific properties of an edge. | + | `FETCH PROP ON serve "player100" -> "team204", "player133" -> "team202"` | Specify multiple edge patterns (` -> [@]`) to fetch properties of multiple edges. Separate the edge patterns with commas. | + | `FETCH PROP ON serve "player100" -> "team204"@1` | To fetch on an edge whose rank is not 0, set its rank in the FETCH statement. | + | `GO FROM "player101" OVER follow YIELD follow._src AS s, follow._dst AS d | FETCH PROP ON follow $-.s -> $-.d YIELD follow.degree` | The following statement returns the `degree` values of the `follow` edges that start from vertex `"player101"`. | + | `$var = GO FROM "player101" OVER follow YIELD follow._src AS s, follow._dst AS d; FETCH PROP ON follow $var.s -> $var.d YIELD follow.degree` | You can use user-defined variables to construct similar queries. | + + + +* [UNWIND](../3.ngql-guide/7.general-query-statements/7.unwind.md) + + ``` + UNWIND AS + ``` + + | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------------------ | + | `UNWIND [1,2,3] AS n RETURN n` | The following example splits the list `[1,2,3]` into three rows. | + | `WITH [1,1,2,2,3,3] AS n UNWIND n AS r WITH DISTINCT r AS r ORDER BY r RETURN collect(r)` | 1. Splits the list `[1,1,2,2,3,3]` into rows. 2. Removes duplicated rows. 3. Sorts the rows. 4. Transforms the rows to a list. | + | `MATCH p=(v:player{name:"Tim Duncan"})--(v2) WITH nodes(p) AS n UNWIND n AS r WITH DISTINCT r AS r RETURN collect(r)` | 1. Outputs the vertices on the matched path into a list. 2. Splits the list into rows. 3. Removes duplicated rows. 4. Transforms the rows to a list. | + + + +* SHOW + + | Statement | Syntax | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------- | ------------------------------------ | -------------------------------------------------------- | + | [SHOW CHARSET](../3.ngql-guide/7.general-query-statements/6.show/1.show-charset.md) | `SHOW CHARSET` | `SHOW CHARSET` | Shows the available character sets. | + | [SHOW COLLATION](../3.ngql-guide/7.general-query-statements/6.show/2.show-collation.md) | `SHOW COLLATION` | `SHOW COLLATION` | Shows the collations supported by Nebula Graph. | + | [SHOW CREATE SPACE](../3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md) | `SHOW CREATE SPACE ` | `SHOW CREATE SPACE basketballplayer` | Shows the creating statement of the specified graph space. | + | [SHOW CREATE TAG/EDGE](../3.ngql-guide/7.general-query-statements/6.show/5.show-create-tag-edge.md) | `SHOW CREATE {TAG | EDGE }` | `SHOW CREATE TAG player` | Shows the basic information of the specified tag. | + | [SHOW HOSTS](../3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md) | `SHOW HOSTS [GRAPH | STORAGE | META]` | `SHOW HOSTS`
`SHOW HOSTS GRAPH` | Shows the host and version information of Graph Service, Storage Service, and Meta Service. | + | [SHOW INDEX STATUS](../3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md) | `SHOW {TAG | EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Shows the status of jobs that rebuild native indexes, which helps check whether a native index is successfully rebuilt or not. | + | [SHOW INDEXES](../3.ngql-guide/7.general-query-statements/6.show/8.show-indexes.md) | `SHOW {TAG | EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the names of existing native indexes. | + | [SHOW PARTS](../3.ngql-guide/7.general-query-statements/6.show/9.show-parts.md) | `SHOW PARTS []` | `SHOW PARTS` | Shows the information of a specified partition or all partitions in a graph space. | + | [SHOW ROLES](../3.ngql-guide/7.general-query-statements/6.show/10.show-roles.md) | `SHOW ROLES IN ` | `SHOW ROLES in basketballplayer` | Shows the roles that are assigned to a user account. | + | [SHOW SNAPSHOTS](../3.ngql-guide/7.general-query-statements/6.show/11.show-snapshots.md) | `SHOW SNAPSHOTS` | `SHOW SNAPSHOTS` | Shows the information of all the snapshots. + | [SHOW SPACES](../3.ngql-guide/7.general-query-statements/6.show/12.show-spaces.md) | `SHOW SPACES` | `SHOW SPACES` | Shows existing graph spaces in Nebula Graph. | + | [SHOW STATS](../3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md) | `SHOW STATS` | `SHOW STATS` | Shows the statistics of the graph space collected by the latest `STATS` job. | + | [SHOW TAGS/EDGES](../3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md) | `SHOW TAGS | EDGES` | `SHOW TAGS`、`SHOW EDGES` | Shows all the tags in the current graph space. | + | [SHOW USERS](../3.ngql-guide/7.general-query-statements/6.show/16.show-users.md) | `SHOW USERS` | `SHOW USERS` | Shows the user information. | + | [SHOW SESSIONS](../3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md) | `SHOW SESSIONS ` | ` SHOW SESSIONS` | Shows the information of all the sessions. | + | [SHOW SESSIONS](../3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md) | `SHOW SESSION ` | `SHOW SESSION 1623304491050858` | Shows a specified session with its ID. | + | [SHOW QUERIES](../3.ngql-guide/7.general-query-statements/6.show/18.show-queries.md) | `SHOW [ALL] QUERIES` | `SHOW QUERIES` | Shows the information of working queries in the current session. | + | [SHOW META LEADER](../3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md) | `SHOW META LEADER` | `SHOW META LEADER` | Shows the information of the leader in the current Meta cluster. | + + + +## Clauses and options + +| Clause | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [GROUP BY](../3.ngql-guide/8.clauses-and-options/group-by.md) | ` GROUP BY YIELD , ` | `GO FROM "player100" OVER follow BIDIRECT YIELD $$.player.name as Name | GROUP BY $-.Name YIELD $-.Name as Player, count(*) AS Name_Count` | Finds all the vertices connected directly to vertex `"player100"`, groups the result set by player names, and counts how many times the name shows up in the result set. | +| [LIMIT](../3.ngql-guide/8.clauses-and-options/limit.md) | `YIELD [| LIMIT [,] ]` | `O FROM "player100" OVER follow REVERSELY YIELD $$.player.name AS Friend, $$.player.age AS Age | ORDER BY $-.Age, $-.Friend | LIMIT 1, 3` | Returns the 3 rows of data starting from the second row of the sorted output. | +| [SKIP](../3.ngql-guide/8.clauses-and-options/limit.md) | `RETURN [SKIP ] [LIMIT ]` | `MATCH (v:player{name:"Tim Duncan"}) --> (v2) RETURN v2.name AS Name, v2.age AS Age ORDER BY Age DESC SKIP 1` | `SKIP` can be used alone to set the offset and return the data after the specified position. | +| [ORDER BY](../3.ngql-guide/8.clauses-and-options/order-by.md) | ` ORDER BY [ASC | DESC] [, [ASC | DESC] ...]` | `FETCH PROP ON player "player100", "player101", "player102", "player103" YIELD player.age AS age, player.name AS name | ORDER BY $-.age ASC, $-.name DESC` | The `ORDER BY` clause specifies the order of the rows in the output. | +| [RETURN](../3.ngql-guide/8.clauses-and-options/return.md) | `RETURN {||.|.|...}` | `MATCH (v:player) RETURN v.name, v.age LIMIT 3` | Returns the first three rows with values of the vertex properties `name` and `age`. | +| [TTL](../3.ngql-guide/8.clauses-and-options/ttl-options.md) | ``CREATE TAG ( , , ...) ttl_duration= , ttl_col = `` | `CREATE TAG t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a"` | Create a tag and set the TTL options. | +| [WHERE](../3.ngql-guide/8.clauses-and-options/where.md) | `WHERE {. {>|==|<|...} ...}` | `MATCH (v:player) WHERE v.name == "Tim Duncan" XOR (v.age < 30 AND v.name == "Yao Ming") OR NOT (v.name == "Yao Ming" OR v.name == "Tim Duncan") RETURN v.name, v.age` | The `WHERE` clause filters the output by conditions. The `WHERE` clause usually works in Native nGQL `GO` and `LOOKUP` statements, and OpenCypher `MATCH` and `WITH` statements. | +| [YIELD](../3.ngql-guide/8.clauses-and-options/yield.md) | `YIELD [DISTINCT] [AS ] [, [AS ] ...] [WHERE ];` | `GO FROM "player100" OVER follow YIELD dst(edge) AS ID | FETCH PROP ON player $-.ID YIELD player.age AS Age | YIELD AVG($-.Age) as Avg_age, count(*)as Num_friends` | Finds the players that "player100" follows and calculates their average age. | +| [WITH](../3.ngql-guide/8.clauses-and-options/with.md) | `MATCH $expressions WITH {nodes()|labels()|...}` | `MATCH p=(v:player{name:"Tim Duncan"})--() WITH nodes(p) AS n UNWIND n AS n1 RETURN DISTINCT n1` | The `WITH` clause can retrieve the output from a query part, process it, and pass it to the next query part as the input. | + + + +## Space statements + +| Statement | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ----------------------------------------------------- | ------------------------------------------------------------ | +| [CREATE SPACE](../3.ngql-guide/9.space-statements/1.create-space.md) | `CREATE SPACE [IF NOT EXISTS] ( [partition_num = ,] [replica_factor = ,] vid_type = {FIXED_STRING()| INT[64]} ) [COMMENT = '']` | `CREATE SPACE my_space_1 (vid_type=FIXED_STRING(30))` | Creates a graph space with | +| [CREATE SPACE](../3.ngql-guide/9.space-statements/1.create-space.md) | `CREATE SPACE AS ` | `CREATE SPACE my_space_4 as my_space_3` | Clone a graph space. | +| [USE](../3.ngql-guide/9.space-statements/2.use-space.md) | `USE ` | `USE space1` | Specifies a graph space as the current working graph space for subsequent queries. | +| [SHOW SPACES](../3.ngql-guide/9.space-statements/3.show-spaces.md) | `SHOW SPACES` | `SHOW SPACES` | Lists all the graph spaces in the Nebula Graph examples. | +| [DESCRIBE SPACE](../3.ngql-guide/9.space-statements/4.describe-space.md) | `DESC[RIBE] SPACE ` | `DESCRIBE SPACE basketballplayer` | Returns the information about the specified graph space.息。 | +| [DROP SPACE](../3.ngql-guide/9.space-statements/5.drop-space.md) | `DROP SPACE [IF EXISTS] ` | `DROP SPACE basketballplayer` | Deletes everything in the specified graph space. | + + + +## TAG statements + +| Statement | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [CREATE TAG](../3.ngql-guide/10.tag-statements/1.create-tag.md) | `CREATE TAG [IF NOT EXISTS] ( [NULL | NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL | NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE TAG woman(name string, age int, married bool, salary double, create_time timestamp) TTL_DURATION = 100, TTL_COL = "create_time"` | Creates a tag with the given name in a graph space. | +| [DROP TAG](../3.ngql-guide/10.tag-statements/2.drop-tag.md) | `DROP TAG [IF EXISTS] ` | `CREATE TAG test(p1 string, p2 int)` | Drops a tag with the given name in the current working graph space. | +| [ALTER TAG](../3.ngql-guide/10.tag-statements/3.alter-tag.md) | `ALTER TAG [, alter_definition] ...] [ttl_definition [, ttl_definition] ... ] [COMMENT = '']` | `ALTER TAG t1 ADD (p3 int, p4 string)` | Alters the structure of a tag with the given name in a graph space. You can add or drop properties, and change the data type of an existing property. You can also set a [TTL](../3.ngql-guide/8.clauses-and-options/ttl-options.md)(Time-To-Live)on a property, or change its TTL duration. | +| [SHOW TAGS](../3.ngql-guide/10.tag-statements/4.show-tags.md) | `SHOW TAGS` | `SHOW TAGS` | Shows the name of all tags in the current graph space. | +| [DESCRIBE TAG](../3.ngql-guide/10.tag-statements/5.describe-tag.md) | `DESC[RIBE] TAG ` | `DESCRIBE TAG player` | Returns the information about a tag with the given name in a graph space, such as field names, data type, and so on. | +| [DELETE TAG](../3.ngql-guide/10.tag-statements/6.delete-tag.md) | `DELETE TAG FROM ` | `DELETE TAG test1 FROM "test"` | Deletes a tag with the given name on a specified vertex. | + + + +## Edge type statements + +| Statement | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | --------------------------------------------------- | +| [CREATE EDGE](../3.ngql-guide/11.edge-type-statements/1.create-edge.md) | `CREATE EDGE [IF NOT EXISTS] ( [NULL | NOT NULL] [DEFAULT ] [COMMENT ''] [{, [NULL | NOT NULL] [DEFAULT ] [COMMENT '']} ...] ) [TTL_DURATION = ] [TTL_COL = ] [COMMENT = ''] ` | `CREATE EDGE e1(p1 string, p2 int, p3 timestamp) TTL_DURATION = 100, TTL_COL = "p2"` | Creates an edge type with the given name in a graph space.type。 | +| [DROP EDGE](../3.ngql-guide/11.edge-type-statements/2.drop-edge.md) | `DROP EDGE [IF EXISTS] ` | `DROP EDGE e1` | Drops an edge type with the given name in a graph space. | +| [ALTER EDGE](../3.ngql-guide/11.edge-type-statements/3.alter-edge.md) | `ALTER EDGE [, alter_definition] ...] [ttl_definition [, ttl_definition] ... ] [COMMENT = '']` | `ALTER EDGE e1 ADD (p3 int, p4 string)` | Alters the structure of an edge type with the given name in a graph space. | +| [SHOW EDGES](../3.ngql-guide/11.edge-type-statements/4.show-edges.md) | `SHOW EDGES` | `SHOW EDGES` | Shows all edge types in the current graph space. | +| [DESCRIBE EDGE](../3.ngql-guide/11.edge-type-statements/5.describe-edge.md) | `DESC[RIBE] EDGE ` | `DESCRIBE EDGE follow` | Returns the information about an edge type with the given name in a graph space, such as field names, data type, and so on. | + + + +## Vertex statements + +| Statement | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md) | `INSERT VERTEX [IF NOT EXISTS] () [, (), ...] {VALUES | VALUE} VID: ([, ])` | `INSERT VERTEX t2 (name, age) VALUES "13":("n3", 12), "14":("n4", 8)` | Inserts one or more vertices into a graph space in Nebula Graph. | +| [DELETE VERTEX](../3.ngql-guide/12.vertex-statements/4.delete-vertex.md) | `DELETE VERTEX [, ...]` | `DELETE VERTEX "team1"` | Deletes vertices and the related incoming and outgoing edges of the vertices. | +| [UPDATE VERTEX](../3.ngql-guide/12.vertex-statements/2.update-vertex.md) | `UPDATE VERTEX ON SET [WHEN ] [YIELD ]` | `UPDATE VERTEX ON player "player101" SET age = age + 2 ` | Updates properties on tags of a vertex. | +| [UPSERT VERTEX](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `UPSERT VERTEX ON SET [WHEN ] [YIELD ]` | `UPSERT VERTEX ON player "player667" SET age = 31` | The `UPSERT` statement is a combination of `UPDATE` and `INSERT`. You can use `UPSERT VERTEX` to update the properties of a vertex if it exists or insert a new vertex if it does not exist. | + + + +## Edge statements + +| Statement | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md) | `INSERT EDGE [IF NOT EXISTS] ( ) {VALUES | VALUE} -> [@] : ( ) [, -> [@] : ( ), ...]` | `INSERT EDGE e2 (name, age) VALUES "11"->"13":("n1", 1)` | Inserts an edge or multiple edges into a graph space from a source vertex (given by src_vid) to a destination vertex (given by dst_vid) with a specific rank in Nebula Graph. | +| [DELETE EDGE](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `DELETE EDGE -> [@] [, -> [@] ...]` | `DELETE EDGE serve "player100" -> "team204"@0` | Deletes one edge or multiple edges at a time. | +| [UPDATE EDGE](../3.ngql-guide/13.edge-statements/2.update-edge.md) | `UPDATE EDGE ON -> [@] SET [WHEN ] [YIELD ]` | `UPDATE EDGE ON serve "player100" -> "team204"@0 SET start_year = start_year + 1` | Updates properties on an edge. | +| [UPSERT EDGE](../3.ngql-guide/12.vertex-statements/3.upsert-vertex.md) | `UPSERT EDGE ON -> [@rank] SET [WHEN ] [YIELD ]` | `UPSERT EDGE on serve "player666" -> "team200"@0 SET end_year = 2021` | The `UPSERT` statement is a combination of `UPDATE` and `INSERT`. You can use `UPSERT EDGE` to update the properties of an edge if it exists or insert a new edge if it does not exist. | + + + +## Index + +* Native index + + > You can use native indexes together with `LOOKUP` and `MATCH` statements. + + | Statement | Syntax | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------- | ------------------------------------------------------------ | + | [CREATE INDEX](../3.ngql-guide/14.native-index-statements/1.create-native-index.md) | `CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] ON { | } ([]) [COMMENT = '']` | `CREATE TAG INDEX player_index on player()` | Add native indexes for the existing tags, edge types, or properties. | + | [SHOW CREATE INDEX](../3.ngql-guide/14.native-index-statements/2.1.show-create-index.md) | `SHOW CREATE {TAG | EDGE} INDEX ` | `show create tag index index_2` | Shows the statement used when creating a tag or an edge type. It contains detailed information about the index, such as its associated properties. | + | [SHOW INDEXES](../3.ngql-guide/14.native-index-statements/2.show-native-indexes.md) | `SHOW {TAG | EDGE} INDEXES` | `SHOW TAG INDEXES` | Shows the defined tag or edge type indexes names in the current graph space. | + | [DESCRIBE INDEX](../3.ngql-guide/14.native-index-statements/3.describe-native-index.md) | `DESCRIBE {TAG | EDGE} INDEX ` | `DESCRIBE TAG INDEX player_index_0` | Gets the information about the index with a given name, including the property name (Field) and the property type (Type) of the index. | + | [REBUILD INDEX](../3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md) | `REBUILD {TAG | EDGE} INDEX []` | `REBUILD TAG INDEX single_person_index` | Rebuilds the created tag or edge type index. If data is updated or inserted before the creation of the index, you must rebuild the indexes **manually** to make sure that the indexes contain the previously added data. | + | [SHOW INDEX STATUS](../3.ngql-guide/14.native-index-statements/5.show-native-index-status.md) | `SHOW {TAG | EDGE} INDEX STATUS` | `SHOW TAG INDEX STATUS` | Returns the name of the created tag or edge type index and its status. | + | [DROP INDEX](../3.ngql-guide/14.native-index-statements/6.drop-native-index.md) | `DROP {TAG | EDGE} INDEX [IF EXISTS] ` | `DROP TAG INDEX player_index_0` | Removes an existing index from the current graph space. | + + + +* [Full-tex index](../4.deployment-and-installation/6.deploy-text-based-index/2.deploy-es.md) + + | Syntax | Example | Description | + | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | + | `SIGN IN TEXT SERVICE [( [,, ]), (), ...]` | `SIGN IN TEXT SERVICE (127.0.0.1:9200)` | The full-text indexes is implemented based on [Elasticsearch](https://en.wikipedia.org/wiki/Elasticsearch). After deploying an Elasticsearch cluster, you can use the `SIGN IN` statement to log in to the Elasticsearch client. | + | `SHOW TEXT SEARCH CLIENTS` | `SHOW TEXT SEARCH CLIENTS` | Shows text search clients. | + | `SIGN OUT TEXT SERVICE` | `SIGN OUT TEXT SERVICE` |Signs out to the text search clients. | + | `CREATE FULLTEXT {TAG | EDGE} INDEX ON { | } ([])` | `CREATE FULLTEXT TAG INDEX nebula_index_1 ON player(name)` | Creates full-text indexes. | + | `SHOW FULLTEXT INDEXES` | `SHOW FULLTEXT INDEXES` | Show full-text indexes. | + | `REBUILD FULLTEXT INDEX` | `REBUILD FULLTEXT INDEX` | Rebuild full-text indexes. | + | `DROP FULLTEXT INDEX ` | `DROP FULLTEXT INDEX nebula_index_1` | Drop full-text indexes. | + | `LOOKUP ON { | } WHERE [YIELD ]` | `LOOKUP ON player WHERE FUZZY(player.name, "Tim Dunncan", AUTO, OR) YIELD player.name` | Use query options. | + + + +## Subgraph and path statements + +| Type | Syntax | Example | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| [GET SUBGRAPH](../3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md) | `GET SUBGRAPH [WITH PROP] [ STEPS] FROM {, ...} [{IN | OUT | BOTH} , ...] [YIELD [VERTICES AS ] [,EDGES AS ]] ` | `GET SUBGRAPH 1 STEPS FROM "player100" YIELD VERTICES AS nodes, EDGES AS relationships` | Retrieves information of vertices and edges reachable from the source vertices of the specified edge types and returns information of the subgraph. | +| [FIND PATH](../3.ngql-guide/16.subgraph-and-path/2.find-path.md) | `FIND { SHORTEST | ALL | NOLOOP } PATH [WITH PROP] FROM TO
OVER [REVERSELY | BIDIRECT] [] [UPTO STEPS] [| ORDER BY $-.path] [| LIMIT ]` | `FIND SHORTEST PATH FROM "player102" TO "team204" OVER *` | Finds the paths between the selected source vertices and destination vertices. A returned path is like `()-[:@]->(` | `EXPLAIN format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Helps output the execution plan of an nGQL statement without executing the statement. | +| [PROFILE](../3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md) | `PROFILE [format="row" | "dot"] ` | `PROFILE format="row" SHOW TAGS`
`EXPLAIN format="dot" SHOW TAGS` | Executes the statement, then outputs the execution plan as well as the execution profile. | + + + +## Operation and maintenance statements + +* [BALANCE](../3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md) + + |Syntax|Description| + |-|-| + |`BALANCE DATA`|Starts a task to balance the distribution of storage partitions in a Nebula Graph cluster or a Group. It returns the task ID (`balance_id`). | + |`BALANCE DATA `|Shows the status of the `BALANCE DATA` task.| + |`BALANCE DATA STOP`|Stops the `BALANCE DATA` task.| + |`BALANCE DATA REMOVE `|Scales in the Nebula Graph cluster and detaches specific storage hosts.| + |`BALANCE LEADER`|Balances the distribution of storage raft leaders in a Nebula Graph cluster or a Group.| + +* [Job statements](../3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md) + + |Syntax|Description| + | -------------------- | ------------------------------------------------------------ | + | `SUBMIT JOB COMPACT` | Triggers the long-term RocksDB `compact` operation. | + | `SUBMIT JOB FLUSH` | Writes the RocksDB memfile in the memory to the hard disk. | + | `SUBMIT JOB STATS` | Starts a job that makes the statistics of the current graph space. Once this job succeeds, you can use the `SHOW STATS` statement to list the statistics. | + | `SHOW JOB ` | Shows the information about a specific job and all its tasks in the current graph space. The Meta Service parses a `SUBMIT JOB` request into multiple tasks and assigns them to the nebula-storaged processes. | + | `SHOW JOBS` | Lists all the unexpired jobs in the current graph space. | + | `STOP JOB` | Stops jobs that are not finished in the current graph space. | + | `RECOVER JOB` | Re-executes the failed jobs in the current graph space and returns the number of recovered jobs. | + +* [Kill queries](../3.ngql-guide/18.operation-and-maintenance-statements/6.kill-query.md) + + | Syntax | Example | Description | + | --------------------------------------------------- | ----------------------------------------------- | -------------------------------------------- | + | `KILL QUERY (session=, plan=)` | `KILL QUERY(SESSION=1625553545984255,PLAN=163)` | Terminates the query being executed, and is often used to terminate slow queries. | + + diff --git a/docs-2.0/2.quick-start/assets.png b/docs-2.0/2.quick-start/assets.png deleted file mode 100644 index f0dba0f5374..00000000000 Binary files a/docs-2.0/2.quick-start/assets.png and /dev/null differ diff --git a/docs-2.0/2.quick-start/console.png b/docs-2.0/2.quick-start/console.png deleted file mode 100644 index 3f08d4ba19b..00000000000 Binary files a/docs-2.0/2.quick-start/console.png and /dev/null differ diff --git a/docs-2.0/20.appendix/0.FAQ.md b/docs-2.0/20.appendix/0.FAQ.md index c4f0f5ec92c..9e46822247d 100644 --- a/docs-2.0/20.appendix/0.FAQ.md +++ b/docs-2.0/20.appendix/0.FAQ.md @@ -32,11 +32,15 @@ Nebula Graph is still under development. Its behavior changes from time to time. ## About executions +### Why is there no line separating each row in the returned result of Nebula Graph 2.6.0? + +This is caused by the release of Nebula Console 2.6.0, not the change of Nebula Graph core. And it will not affect the content of the returned data itself. + ### About dangling edges A dangling edge is an edge that only connects to a single vertex and only one part of the edge connects to the vertex. -Nebula Graph {{ nebula.release }} allows dangling edges. And there is no `MERGE` statements of openCypher. The guarantee for dangling edges depends entirely on the application level. For more information, see [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md), [DELETE VERTEX](../3.ngql-guide/12.vertex-statements/4.delete-vertex.md), [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md), [DELETE EDGE](../3.ngql-guide/13.edge-statements/4.delete-edge.md). +Dangling edges may appear in Nebula Graph {{ nebula.release }} under unusual conditions. And there is no `MERGE` statements of openCypher. The guarantee for dangling edges depends entirely on the application level. For more information, see [INSERT VERTEX](../3.ngql-guide/12.vertex-statements/1.insert-vertex.md), [DELETE VERTEX](../3.ngql-guide/12.vertex-statements/4.delete-vertex.md), [INSERT EDGE](../3.ngql-guide/13.edge-statements/1.insert-edge.md), [DELETE EDGE](../3.ngql-guide/13.edge-statements/4.delete-edge.md). ### "How to resolve `[ERROR (-1005)]: Used memory hits the high watermark(0.800000) of total system memory.`?" @@ -72,11 +76,11 @@ Take the returned message of `SHOW SPACES` as an example: ```nGQL nebula> SHOW SPACES; -+-------------------+ -| Name | -+-------------------+ -| basketballplayer | -+-------------------+ ++--------------------+ +| Name | ++--------------------+ +| "basketballplayer" | ++--------------------+ Got 1 rows (time spent 1235/1934 us) ``` @@ -139,8 +143,8 @@ See [show-stats](../3.ngql-guide/7.general-query-statements/6.show/14.show-stats 1. Create and rebuild the index. ```ngql - > CREATE TAG INDEX i_player ON player(); - > REBUILD TAG INDEX i_player; + > CREATE TAG INDEX IF NOT EXISTS i_player ON player(); + > REBUILD TAG INDEX IF NOT EXISTS i_player; ``` 2. Use `LOOKUP` or `MATCH`. For example: @@ -175,7 +179,7 @@ The graphd process requires `start vids` to begin a graph traversal. The `start It can also be found from a property index. For example: ```ngql -# CREATE TAG INDEX i_player ON player(name(20)); +# CREATE TAG INDEX IF NOT EXISTS i_player ON player(name(20)); # REBUILD TAG INDEX i_player; > LOOKUP ON player WHERE player.name == "abc" | ... YIELD ... diff --git a/docs-2.0/20.appendix/6.eco-tool-version.md b/docs-2.0/20.appendix/6.eco-tool-version.md index 18e6b2b3fc1..00acb9096c3 100644 --- a/docs-2.0/20.appendix/6.eco-tool-version.md +++ b/docs-2.0/20.appendix/6.eco-tool-version.md @@ -36,15 +36,25 @@ Nebula Graph Studio (Studio for short) is a graph database visualization tool th |Nebula Graph version|Studio version(commit id)| |:---|:---| -| {{ nebula.release }} | {{studio.base300}}(9e2a120)| +| {{ nebula.release }} | {{studio.release}}(3754219)| -## Nebula Dashboard +## Nebula Dashboard Community Edition -Nebula Dashboard (Dashboard for short) is a visualization tool for monitoring the status of machines and services in the Nebula Graph cluster. For details, see [What is Nebula Dashboard](../nebula-dashboard/1.what-is-dashboard.md). +Nebula Dashboard Community Edition (Dashboard for short) is a visualization tool for monitoring the status of machines and services in the Nebula Graph cluster. For details, see [What is Nebula Dashboard](../nebula-dashboard/1.what-is-dashboard.md). |Nebula Graph version|Dashboard version (commit id)| |:---|:---| -| {{ nebula.release }} | {{dashboard.release}}(49ab1bc) | +| {{ nebula.release }} | {{dashboard.release}}(a610013) | + + +## Nebula Dashboard Enterprise Edition + +Nebula Dashboard Enterprise Edition (Dashboard for short) is a visualization tool that monitors and manages the status of machines and services in Nebula Graph cluster. For details, see [What is Nebula Dashboard](../nebula-dashboard-ent/1.what-is-dashboard-ent.md). + +|Nebula Graph version|Dashboard version (commit id)| +|:---|:---| +| {{ nebula.release }} | {{dashboard_ent.release}}(3474c78) | + ## Nebula Explorer @@ -52,15 +62,15 @@ Nebula Explorer (Explorer for short) is a graph exploration visualization tool t |Nebula Graph version|Explorer version (commit id)| |:---|:---| -| {{ nebula.release }} | {{explorer.base100}}(3b82142) | +| {{ nebula.release }} | {{explorer.release}}(3acdd02) | ## Nebula Exchange Nebula Exchange (Exchange for short) is an Apache Spark&trade application for batch migration of data in a cluster to Nebula Graph in a distributed environment. It can support the migration of batch data and streaming data in a variety of different formats. For details, see [What is Nebula Exchange](../nebula-exchange/about-exchange/ex-ug-what-is-exchange.md). -|Nebula Graph version|Exchange version (commit id)| -|:---|:---| -| {{ nebula.release }} | {{exchange.release}}(2c61ca5) | +|Nebula Graph version|Exchange community version (commit id)|Exchange enterprise(commit id)| +|:---|:---|:--| +| {{ nebula.release }} | {{exchange.release}}(e6d8601) |{{exchange_ent.release}}(9c54c97) | ## Nebula Operator @@ -76,7 +86,7 @@ Nebula Importer (Importer for short) is a CSV file import tool for Nebula Graph. |Nebula Graph version|[Importer](https://github.com/vesoft-inc/nebula-importer/tree/{{importer.branch}}) version (commit id)| |:---|:---| -| {{ nebula.release }} | {{importer.release}}(5c7417d) | +| {{ nebula.release }} | {{importer.release}}(43234f3) | ## Nebula Spark Connector @@ -84,7 +94,7 @@ Nebula Spark Connector is a Spark connector that provides the ability to read an |Nebula Graph version|Spark Connector version (commit id)| |:---|:---| -| {{ nebula.release }} | {{sparkconnector.release}}(2c61ca5) | +| {{ nebula.release }} | {{sparkconnector.release}}(aac22e1) | ## Nebula Flink Connector @@ -92,7 +102,7 @@ Nebula Flink Connector is a connector that helps Flink users quickly access Nebu |Nebula Graph version|Flink Connector version (commit id)| |:---|:---| -| {{ nebula.release }} | {{flinkconnector.release}}(49b8f3d) | +| {{ nebula.release }} | {{flinkconnector.release}}(79bd8d4) | ## Nebula Algorithm @@ -108,7 +118,7 @@ Nebula Console is the native CLI client of Nebula Graph. For how to use it, see |Nebula Graph version|Console version (commit id)| |:---|:---| -| {{ nebula.release }} | {{console.release}}(3ce5151) | +| {{ nebula.release }} | {{console.release}}(0834198) | ## Nebula Docker Compose @@ -116,7 +126,7 @@ Docker Compose can quickly deploy Nebula Graph clusters. For how to use it, plea |Nebula Graph version|[Docker Compose](https://github.com/vesoft-inc/nebula-docker-compose/tree/master) version (commit id)| |:---|:---| -| {{ nebula.release }} | {{dockercompose.release}}(d42231f) | +| {{ nebula.release }} | {{dockercompose.release}}(a6e9d78) | diff --git a/docs-2.0/3.ngql-guide/14.native-index-statements/2.1.show-create-index.md b/docs-2.0/3.ngql-guide/14.native-index-statements/2.1.show-create-index.md index 2dec87fc676..dd30ae03308 100644 --- a/docs-2.0/3.ngql-guide/14.native-index-statements/2.1.show-create-index.md +++ b/docs-2.0/3.ngql-guide/14.native-index-statements/2.1.show-create-index.md @@ -14,18 +14,19 @@ You can run `SHOW TAG INDEXES` to list all tag indexes, and then use `SHOW CREAT ```ngql nebula> SHOW TAG INDEXES; -+------------------+--------------+-----------------+ -| "player_index_0" | "player" | ["name"] | -+------------------+--------------+-----------------+ -| "player_index_1" | "player" | ["name", "age"] | -+------------------+--------------+-----------------+ ++------------------+----------+----------+ +| Index Name | By Tag | Columns | ++------------------+----------+----------+ +| "player_index_0" | "player" | [] | +| "player_index_1" | "player" | ["name"] | ++------------------+----------+----------+ nebula> SHOW CREATE TAG INDEX player_index_1; +------------------+--------------------------------------------------+ | Tag Index Name | Create Tag Index | +------------------+--------------------------------------------------+ | "player_index_1" | "CREATE TAG INDEX `player_index_1` ON `player` ( | -| | `name(20)` | +| | `name`(20) | | | )" | +------------------+--------------------------------------------------+ ``` diff --git a/docs-2.0/3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md b/docs-2.0/3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md index 3dbf0f8c143..5b143208bfa 100644 --- a/docs-2.0/3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md +++ b/docs-2.0/3.ngql-guide/14.native-index-statements/4.rebuild-native-index.md @@ -24,8 +24,8 @@ REBUILD {TAG | EDGE} INDEX []; ## Examples ```ngql -nebula> CREATE TAG person(name string, age int, gender string, email string); -nebula> CREATE TAG INDEX single_person_index ON person(name(10)); +nebula> CREATE TAG IF NOT EXISTS person(name string, age int, gender string, email string); +nebula> CREATE TAG INDEX IF NOT EXISTS single_person_index ON person(name(10)); # The following example rebuilds an index and returns the job ID. nebula> REBUILD TAG INDEX single_person_index; diff --git a/docs-2.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index.md b/docs-2.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index.md index c2864586479..c284145986b 100644 --- a/docs-2.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index.md +++ b/docs-2.0/3.ngql-guide/15.full-text-index-statements/1.search-with-text-based-index.md @@ -74,7 +74,7 @@ LOOKUP ON { | } WHERE [YIELD ]; ```ngql // This example creates the graph space. -nebula> CREATE SPACE basketballplayer (partition_num=3,replica_factor=1, vid_type=fixed_string(30)); +nebula> CREATE SPACE IF NOT EXISTS basketballplayer (partition_num=3,replica_factor=1, vid_type=fixed_string(30)); // This example signs in the text service. nebula> SIGN IN TEXT SERVICE (127.0.0.1:9200); @@ -86,10 +86,10 @@ nebula> USE basketballplayer; nebula> ADD LISTENER ELASTICSEARCH 192.168.8.5:9789; // This example creates the tag. -nebula> CREATE TAG player(name string, age int); +nebula> CREATE TAG IF NOT EXISTS player(name string, age int); // This example creates the native index. -nebula> CREATE TAG INDEX name ON player(name(20)); +nebula> CREATE TAG INDEX IF NOT EXISTS name ON player(name(20)); // This example rebuilds the native index. nebula> REBUILD TAG INDEX; diff --git a/docs-2.0/3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md b/docs-2.0/3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md index b538bfa48dd..fdc9370e02a 100644 --- a/docs-2.0/3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md +++ b/docs-2.0/3.ngql-guide/16.subgraph-and-path/1.get-subgraph.md @@ -28,53 +28,72 @@ GET SUBGRAPH [WITH PROP] [ STEPS] FROM {, ...} The following graph is used as the sample. -![A sample graph for GET SUBGRAPH](https://docs-cdn.nebula-graph.com.cn/docs-2.0/2.quick-start/dataset-for-crud.png) +![A sample graph for GET SUBGRAPH](../../2.quick-start/dataset-for-crud.png) -* This example goes one step from the vertex `player100` over all edge types and gets the subgraph. +Insert the test data: + +```ngql +nebula> CREATE SPACE IF NOT EXISTS subgraph(partition_num=15, replica_factor=1, vid_type=fixed_string(30)); +nebula> USE subgraph; +nebula> CREATE TAG IF NOT EXISTS player(name string, age int); +nebula> CREATE TAG IF NOT EXISTS team(name string); +nebula> CREATE EDGE IF NOT EXISTS follow(degree int); +nebula> CREATE EDGE IF NOT EXISTS serve(start_year int, end_year int); +nebula> INSERT VERTEX player(name, age) VALUES "player100":("Tim Duncan", 42); +nebula> INSERT VERTEX player(name, age) VALUES "player101":("Tony Parker", 36); +nebula> INSERT VERTEX player(name, age) VALUES "player102":("LaMarcus Aldridge", 33); +nebula> INSERT VERTEX team(name) VALUES "team203":("Trail Blazers"), "team204":("Spurs"); +nebula> INSERT EDGE follow(degree) VALUES "player101" -> "player100":(95); +nebula> INSERT EDGE follow(degree) VALUES "player101" -> "player102":(90); +nebula> INSERT EDGE follow(degree) VALUES "player102" -> "player100":(75); +nebula> INSERT EDGE serve(start_year, end_year) VALUES "player101" -> "team204":(1999, 2018),"player102" -> "team203":(2006, 2015); +``` + +* This example goes one step from the vertex `player101` over all edge types and gets the subgraph. ```ngql - nebula> GET SUBGRAPH 1 STEPS FROM "player100" YIELD VERTICES AS nodes, EDGES AS relationships; + nebula> GET SUBGRAPH 1 STEPS FROM "player101" YIELD VERTICES AS nodes, EDGES AS relationships; +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ | nodes | relationships | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ - | [("player100" :player{})] | [[:follow "player100"->"player101" @0 {}], [:follow "player100"->"player102" @0 {}], [:serve "player100"->"team200" @0 {}]] | - | [("player101" :player{}), ("player102" :player{}), ("team200" :team{})] | [[:follow "player102"->"player101" @0 {}]] | + | [("player101" :player{})] | [[:serve "player101"->"team204" @0 {}], [:follow "player101"->"player100" @0 {}], [:follow "player101"->"player102" @0 {}]] | + | [("team204" :team{}), ("player100" :player{}), ("player102" :player{})] | [[:follow "player102"->"player100" @0 {}]] | +-------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+ ``` The returned subgraph is as follows. - ![GET SUBGRAPH FROM "player100"](https://docs-cdn.nebula-graph.com.cn/docs-2.0/3.ngql-guide/15.subgraph-and-path/subgraph-1.png) + ![GET SUBGRAPH FROM "player101"](subgraph-1.png) -* This example goes one step from the vertex `player100` over incoming `follow` edges and gets the subgraph. +* This example goes one step from the vertex `player101` over incoming `follow` edges and gets the subgraph. ```ngql - nebula> GET SUBGRAPH 1 STEPS FROM "player100" IN follow YIELD VERTICES AS nodes, EDGES AS relationships; + nebula> GET SUBGRAPH 1 STEPS FROM "player101" IN follow YIELD VERTICES AS nodes, EDGES AS relationships; +---------------------------+---------------+ | nodes | relationships | +---------------------------+---------------+ - | [("player100" :player{})] | [] | + | [("player101" :player{})] | [] | | [] | [] | +---------------------------+---------------+ ``` - There is no incoming `follow` edge to `player100`, so no vertex or edge is returned. + There is no incoming `follow` edge to `player101`, so only the vertex `player101` is returned. -* This example goes one step from the vertex `player100` over outgoing `serve` edges, gets the subgraph, and shows the property of the edge. +* This example goes one step from the vertex `player101` over outgoing `serve` edges, gets the subgraph, and shows the property of the edge. ```ngql - nebula> GET SUBGRAPH WITH PROP 1 STEPS FROM "player100" OUT serve YIELD VERTICES AS nodes, EDGES AS relationships; - +------------------------------------------------------+-------------------------------------------------------------------------+ - | nodes | relationships | - +------------------------------------------------------+-------------------------------------------------------------------------+ - | [("player100" :player{age: 42, name: "Tim Duncan"})] | [[:serve "player100"->"team200" @0 {end_year: 2016, start_year: 1997}]] | - | [("team200" :team{name: "Warriors"})] | [] | - +------------------------------------------------------+-------------------------------------------------------------------------+ + nebula> GET SUBGRAPH WITH PROP 1 STEPS FROM "player101" OUT serve YIELD VERTICES AS nodes, EDGES AS relationships; + +-------------------------------------------------------+-------------------------------------------------------------------------+ + | nodes | relationships | + +-------------------------------------------------------+-------------------------------------------------------------------------+ + | [("player101" :player{age: 36, name: "Tony Parker"})] | [[:serve "player101"->"team204" @0 {end_year: 2018, start_year: 1999}]] | + | [("team204" :team{name: "Spurs"})] | [] | + +-------------------------------------------------------+-------------------------------------------------------------------------+ ``` The returned subgraph is as follows. - -![GET SUBGRAPH FROM "100" OUT serve](https://docs-cdn.nebula-graph.com.cn/docs-2.0/3.ngql-guide/15.subgraph-and-path/subgraph-2.png) + + ![GET SUBGRAPH FROM "101" OUT serve](subgraph-2.png) ## FAQ @@ -101,11 +120,11 @@ nebula> go 1 steps from "A" over follow; The query stops when there is not enough subgraph data and will not return the null value. ```ngql -nebula> GET SUBGRAPH 100 STEPS FROM "player141" OUT follow YIELD VERTICES AS nodes, EDGES AS relationships; -+---------------------------+--------------------------------------------+ -| nodes | relationships | -+---------------------------+--------------------------------------------+ -| [("player141" :player{})] | [[:follow "player141"->"player124" @0 {}]] | -| [("player124" :player{})] | [[:follow "player124"->"player141" @0 {}]] | -+---------------------------+--------------------------------------------+ +nebula> GET SUBGRAPH 100 STEPS FROM "player101" OUT follow YIELD VERTICES AS nodes, EDGES AS relationships; ++----------------------------------------------------+--------------------------------------------------------------------------------------+ +| nodes | relationships | ++----------------------------------------------------+--------------------------------------------------------------------------------------+ +| [("player101" :player{})] | [[:follow "player101"->"player100" @0 {}], [:follow "player101"->"player102" @0 {}]] | +| [("player100" :player{}), ("player102" :player{})] | [[:follow "player102"->"player100" @0 {}]] | ++----------------------------------------------------+--------------------------------------------------------------------------------------+ ``` diff --git a/docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md b/docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md index 0dba2b8593a..2a2bf0b760c 100644 --- a/docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md +++ b/docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md @@ -76,8 +76,8 @@ nebula> FIND ALL PATH FROM "player100" TO "team204" OVER * WHERE follow.degree i | <("player100")-[:serve@0 {}]->("team204")> | | <("player100")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> | | <("player100")-[:follow@0 {}]->("player101")-[:serve@0 {}]->("team204")> | +|... | +------------------------------------------------------------------------------+ -... ``` ```ngql diff --git a/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md b/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md index b04ec9d9217..b73f8faf526 100644 --- a/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md +++ b/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/2.balance-syntax.md @@ -6,8 +6,8 @@ The `BALANCE` statements are listed as follows. |Syntax|Description| |-|-| -|`BALANCE DATA`|Starts a task to balance the distribution of storage partitions in a Nebula Graph cluster. It returns the task ID (`balance_id`). | +|`BALANCE DATA`|Starts a task to balance the distribution of storage partitions in a Nebula Graph cluster or a Group. It returns the task ID (`balance_id`). | |`BALANCE DATA `|Shows the status of the `BALANCE DATA` task.| |`BALANCE DATA STOP`|Stops the `BALANCE DATA` task.| |`BALANCE DATA REMOVE `|Scales in the Nebula Graph cluster and detaches specific storage hosts.| -|`BALANCE LEADER`|Balances the distribution of storage raft leaders in a Nebula Graph cluster.| +|`BALANCE LEADER`|Balances the distribution of storage raft leaders in a Nebula Graph cluster or a Group.| diff --git a/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md b/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md index 04ef1645b2c..cfbf6f89d50 100644 --- a/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md +++ b/docs-2.0/3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md @@ -53,7 +53,7 @@ nebula> SUBMIT JOB STATS; +------------+ | New Job Id | +------------+ -| 97 | +| 34 | +------------+ ``` @@ -66,15 +66,13 @@ The Meta Service parses a `SUBMIT JOB` request into multiple tasks and assigns t ### Example ```ngql -nebula> SHOW JOB 96; -+----------------+---------------+------------+-------------------------+-------------------------+ -| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | -+----------------+---------------+------------+-------------------------+-------------------------+ -| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 | -| 0 | "storaged2" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 | -| 1 | "storaged0" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 | -| 2 | "storaged1" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 | -+----------------+---------------+------------+-------------------------+-------------------------+ +nebula> SHOW JOB 34; ++----------------+-----------------+------------+----------------------------+----------------------------+ +| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | ++----------------+-----------------+------------+----------------------------+----------------------------+ +| 34 | "STATS" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:27.000000 | +| 0 | "192.168.8.111" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:41.000000 | ++----------------+-----------------+------------+----------------------------+----------------------------+ ``` The descriptions are as follows. @@ -120,14 +118,15 @@ The default job expiration interval is one week. You can change it by modifying ```ngql nebula> SHOW JOBS; -+--------+----------------------+------------+-------------------------+-------------------------+ -| Job Id | Command | Status | Start Time | Stop Time | -+--------+----------------------+------------+-------------------------+-------------------------+ -| 97 | "STATS" | "FINISHED" | 2020-11-28T14:48:52.000 | 2020-11-28T14:48:52.000 | -| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 | -| 95 | "STATS" | "FINISHED" | 2020-11-28T13:02:11.000 | 2020-11-28T13:02:11.000 | -| 86 | "REBUILD_EDGE_INDEX" | "FINISHED" | 2020-11-26T13:38:24.000 | 2020-11-26T13:38:24.000 | -+--------+----------------------+------------+-------------------------+-------------------------+ ++--------+---------------------+------------+----------------------------+----------------------------+ +| Job Id | Command | Status | Start Time | Stop Time | ++--------+---------------------+------------+----------------------------+----------------------------+ +| 34 | "STATS" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:27.000000 | +| 33 | "FLUSH" | "FINISHED" | 2021-11-01T03:32:15.000000 | 2021-11-01T03:32:15.000000 | +| 32 | "COMPACT" | "FINISHED" | 2021-11-01T03:32:06.000000 | 2021-11-01T03:32:06.000000 | +| 31 | "REBUILD_TAG_INDEX" | "FINISHED" | 2021-10-29T05:39:16.000000 | 2021-10-29T05:39:17.000000 | +| 10 | "COMPACT" | "FINISHED" | 2021-10-26T02:27:05.000000 | 2021-10-26T02:27:05.000000 | ++--------+---------------------+------------+----------------------------+----------------------------+ ``` ## STOP JOB diff --git a/docs-2.0/3.ngql-guide/3.data-types/10.geography.md b/docs-2.0/3.ngql-guide/3.data-types/10.geography.md index 32da638fb4e..39702db56df 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/10.geography.md +++ b/docs-2.0/3.ngql-guide/3.data-types/10.geography.md @@ -28,19 +28,19 @@ For functions about the geography data type, see [Geography functions](../6.func ```ngql //Create a Tag to allow storing any geography data type. -nebula> CREATE TAG any_shape(geo geography); +nebula> CREATE TAG IF NOT EXISTS any_shape(geo geography); //Create a Tag to allow storing a point only. -nebula> CREATE TAG only_point(geo geography(point)); +nebula> CREATE TAG IF NOT EXISTS only_point(geo geography(point)); //Create a Tag to allow storing a linestring only. -nebula> CREATE TAG only_linestring(geo geography(linestring)); +nebula> CREATE TAG IF NOT EXISTS only_linestring(geo geography(linestring)); //Create a Tag to allow storing a polygon only. -nebula> CREATE TAG only_polygon(geo geography(polygon)); +nebula> CREATE TAG IF NOT EXISTS only_polygon(geo geography(polygon)); //Create an Edge type to allow storing any geography data type. -nebula> CREATE EDGE any_shape_edge(geo geography); +nebula> CREATE EDGE IF NOT EXISTS any_shape_edge(geo geography); //Create a vertex to store the geography of a polygon. nebula> INSERT VERTEX any_shape(geo) VALUES "103":(ST_GeogFromText("POLYGON((0 1, 1 2, 2 3, 0 1))")); @@ -65,7 +65,7 @@ nebula> FETCH PROP ON any_shape_edge "201"->"302" YIELD ST_ASText(any_shape_edge +---------------------+---------------------+----------------------+---------------------------------+ //Create an index for the geography of the Tag any_shape and run LOOKUP. -nebula> CREATE TAG INDEX any_shape_geo_index ON any_shape(geo); +nebula> CREATE TAG INDEX IF NOT EXISTS any_shape_geo_index ON any_shape(geo); nebula> REBUILD TAG INDEX any_shape_geo_index; nebula> LOOKUP ON any_shape YIELD ST_ASText(any_shape.geo); +----------+-------------------------------------------------+ diff --git a/docs-2.0/3.ngql-guide/3.data-types/3.string.md b/docs-2.0/3.ngql-guide/3.data-types/3.string.md index 68e57c7672c..761b8737041 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/3.string.md +++ b/docs-2.0/3.ngql-guide/3.data-types/3.string.md @@ -24,13 +24,13 @@ For example: - Define the data type of the property as a fixed-length string ```ngql - nebula> CREATE TAG t1 (p1 FIXED_STRING(10)); + nebula> CREATE TAG IF NOT EXISTS t1 (p1 FIXED_STRING(10)); ``` - Define the data type of the property as a variable-length string ```ngql - nebula> CREATE TAG t2 (p2 STRING); + nebula> CREATE TAG IF NOT EXISTS t2 (p2 STRING); ``` When the fixed-length string you try to write exceeds the length limit: diff --git a/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md b/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md index a2be0f8a1bf..4676dfde697 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md +++ b/docs-2.0/3.ngql-guide/3.data-types/4.date-and-time.md @@ -55,7 +55,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par ```ngql # Return the current time. - nebula> return timestamp(); + nebula> RETURN timestamp(); +-------------+ | timestamp() | +-------------+ @@ -63,7 +63,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par +-------------+ # Return the specified time. - nebula> return timestamp("2021-07-05T06:18:43.984000"); + nebula> RETURN timestamp("2021-07-05T06:18:43.984000"); +-----------------------------------------+ | timestamp("2021-07-05T06:18:43.984000") | +-----------------------------------------+ @@ -78,7 +78,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par 1. Create a tag named `date1` with three properties: `DATE`, `TIME`, and `DATETIME`. ```ngql - nebula> CREATE TAG date1(p1 date, p2 time, p3 datetime); + nebula> CREATE TAG IF NOT EXISTS date1(p1 date, p2 time, p3 datetime); ``` 2. Insert a vertex named `test1`. @@ -90,7 +90,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par 3. Return the content of the property `p1` on `test1`. ```ngql - nebula> CREATE TAG INDEX date1_index ON date1(p1); + nebula> CREATE TAG INDEX IF NOT EXISTS date1_index ON date1(p1); nebula> REBUILD TAG INDEX date1_index; nebula> MATCH (v:date1) RETURN v.p1; +------------+ @@ -103,7 +103,7 @@ The `TIMESTAMP` data type is used for values that contain both date and time par 4. Create a tag named `school` with the property of `TIMESTAMP`. ```ngql - nebula> CREATE TAG school(name string , found_time timestamp); + nebula> CREATE TAG IF NOT EXISTS school(name string , found_time timestamp); ``` 5. Insert a vertex named `DUT` with a found-time timestamp of `"1988-03-01T08:00:00"`. @@ -138,7 +138,7 @@ nebula> WITH time({hour: 12, minute: 31, second: 14, millisecond:111, microsecon nebula> WITH date({year: 1984, month: 10, day: 11}) AS x RETURN x + 1; +------------+ -| x | +| (x+1) | +------------+ | 1984-10-12 | +------------+ diff --git a/docs-2.0/3.ngql-guide/3.data-types/5.null.md b/docs-2.0/3.ngql-guide/3.data-types/5.null.md index aa381b66c65..e6e6f09679e 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/5.null.md +++ b/docs-2.0/3.ngql-guide/3.data-types/5.null.md @@ -37,7 +37,7 @@ The NULL operations and RETURN with NULL are incompatible with openCypher. Create a tag named `player`. Specify the property `name` as `NOT NULL`. ```ngql -nebula> CREATE TAG player(name string NOT NULL, age int); +nebula> CREATE TAG IF NOT EXISTS player(name string NOT NULL, age int); ``` Use `SHOW` to create tag statements. The property `name` is `NOT NULL`. The property `age` is `NULL` by default. @@ -65,7 +65,7 @@ nebula> INSERT VERTEX player(name, age) VALUES "Kobe":("Kobe",null); Create a tag named `player`. Specify the property `age` as `NOT NULL`. The default value is `18`. ```ngql -nebula> CREATE TAG player(name string, age int NOT NULL DEFAULT 18); +nebula> CREATE TAG IF NOT EXISTS player(name string, age int NOT NULL DEFAULT 18); ``` Insert the vertex `Kobe`. Specify the property `name` only. @@ -77,7 +77,7 @@ nebula> INSERT VERTEX player(name) VALUES "Kobe":("Kobe"); Query the vertex `Kobe`. The property `age` is `18` by default. ```ngql -nebula> FETCH PROP ON player "Kobe" +nebula> FETCH PROP ON player "Kobe"; +-----------------------------------------+ | vertices_ | +-----------------------------------------+ diff --git a/docs-2.0/3.ngql-guide/3.data-types/8.map.md b/docs-2.0/3.ngql-guide/3.data-types/8.map.md index df8cbb7aada..06fc97d3de0 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/8.map.md +++ b/docs-2.0/3.ngql-guide/3.data-types/8.map.md @@ -5,7 +5,7 @@ The map is a composite data type. Maps are unordered collections of key-value pa ## Literal maps ```ngql -nebula> YIELD {key: 'Value', listKey: [{inner: 'Map1'}, {inner: 'Map2'}]} +nebula> YIELD {key: 'Value', listKey: [{inner: 'Map1'}, {inner: 'Map2'}]}; +-------------------------------------------------------------+ | {key:Value,listKey:[{inner:Map1},{inner:Map2}]} | +-------------------------------------------------------------+ diff --git a/docs-2.0/3.ngql-guide/3.data-types/9.type-conversion.md b/docs-2.0/3.ngql-guide/3.data-types/9.type-conversion.md index 1a076460992..516d932a38e 100644 --- a/docs-2.0/3.ngql-guide/3.data-types/9.type-conversion.md +++ b/docs-2.0/3.ngql-guide/3.data-types/9.type-conversion.md @@ -20,7 +20,8 @@ Converting an expression of a given type to another type is known as type conver ## Examples ```ngql -nebula> UNWIND [true, false, 'true', 'false', NULL] AS b RETURN toBoolean(b) AS b; +nebula> UNWIND [true, false, 'true', 'false', NULL] AS b \ + RETURN toBoolean(b) AS b; +----------+ | b | +----------+ @@ -45,7 +46,8 @@ nebula> RETURN toInteger(1), toInteger('1'), toInteger('1e3'), toInteger('not a | 1 | 1 | 1000 | __NULL__ | +--------------+----------------+------------------+---------------------------+ -nebula> MATCH (a:player)-[e]-() RETURN type(e); +nebula> MATCH (a:player)-[e]-() \ + RETURN type(e); +----------+ | type(e) | +----------+ @@ -53,14 +55,18 @@ nebula> MATCH (a:player)-[e]-() RETURN type(e); | "follow" | +----------+ -nebula> MATCH (a:player {name: "Tim Duncan"}) WHERE toInteger(id(a)) == 100 RETURN a; -+----------------------------------------------+ -| a | -+----------------------------------------------+ -| ("100" :player{age: 42, name: "Tim Duncan"}) | -+----------------------------------------------+ +nebula> MATCH (a:player {name: "Tim Duncan"}) \ + WHERE toInteger(right(id(a),3)) == 100 \ + RETURN a; ++----------------------------------------------------+ +| a | ++----------------------------------------------------+ +| ("player100" :player{age: 42, name: "Tim Duncan"}) | ++----------------------------------------------------+ -nebula> MATCH (n:player) WITH n LIMIT toInteger(ceil(1.8)) RETURN count(*) AS count; +nebula> MATCH (n:player) \ + WITH n LIMIT toInteger(ceil(1.8)) \ + RETURN count(*) AS count; +-------+ | count | +-------+ diff --git a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md index 96ff410c881..20a631dc564 100644 --- a/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md +++ b/docs-2.0/3.ngql-guide/4.variable-and-composite-queries/3.property-reference.md @@ -61,35 +61,46 @@ Apart from the user-defined edge property, there are four built-in properties in The following query returns the `name` property of the `player` tag on the source vertex and the `age` property of the `player` tag on the destination vertex. ```ngql -nebula> GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge; +nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge; +--------------+--------+ | startName | endAge | +--------------+--------+ | "Tim Duncan" | 36 | -| "Tim Duncan" | 33 | +| "Tim Duncan" | 41 | +--------------+--------+ ``` The following query returns the `degree` property of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD properties(edge).degree; +nebula> GO FROM "player100" OVER follow YIELD follow.degree; +---------------+ | follow.degree | +---------------+ | 95 | -| 90 | +---------------+ ``` The following query returns the source vertex, the destination vertex, the edge type, and the edge rank value of the edge type `follow`. ```ngql -nebula> GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge); -+-------------+-------------+------------+------------+ -| src(EDGE) | dst(EDGE) | type(EDGE) | rank(EDGE) | -+-------------+-------------+------------+------------+ -| "player100" | "player101" | "follow" | 0 | -| "player100" | "player125" | "follow" | 0 | -+-------------+-------------+------------+------------+ +nebula> GO FROM "player100" OVER follow YIELD follow._src, follow._dst, follow._type, follow._rank; ++-------------+-------------+--------------+--------------+ +| follow._src | follow._dst | follow._type | follow._rank | ++-------------+-------------+--------------+--------------+ +| "player100" | "player101" | 17 | 0 | +| "player100" | "player125" | 17 | 0 | ++-------------+-------------+--------------+--------------+ ``` + +!!! compatibility "Legacy version compatibility" + + Nebula Graph 2.6.0 and later versions support the new [Schema function](../6.functions-and-expressions/4.schema.md). The statements in the above examples are written as follows in 2.6.0. + + ```ngql + GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge; + GO FROM "player100" OVER follow YIELD properties(edge).degree; + GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge); + ``` + + In 2.6.0, Nebula Graph is still compatible with the old syntax. diff --git a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md index ec248e027e8..9c9b1f9dc59 100644 --- a/docs-2.0/3.ngql-guide/5.operators/1.comparison.md +++ b/docs-2.0/3.ngql-guide/5.operators/1.comparison.md @@ -118,11 +118,11 @@ nebula> YIELD 0.11 <= 0.11; ```ngql nebula> YIELD 1 != '1'; -+--------+ -| (1!=1) | -+--------+ -| true | -+--------+ ++----------+ +| (1!="1") | ++----------+ +| true | ++----------+ ``` ### `IS [NOT] NULL` diff --git a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md index 99df7df1ed0..7f12a148173 100644 --- a/docs-2.0/3.ngql-guide/5.operators/4.pipe.md +++ b/docs-2.0/3.ngql-guide/5.operators/4.pipe.md @@ -24,9 +24,11 @@ nebula> GO FROM "player100" OVER follow \ +-------------+ | follow._dst | +-------------+ -| "player101" | +| "player100" | +| "player102" | +| "player125" | +| "player100" | +-------------+ -|... | ``` If there is no `YIELD` clause to define the output, the destination vertex ID is returned by default. If a YIELD clause is applied, the output is defined by the YIELD clause. @@ -35,7 +37,7 @@ Users must define aliases in the `YIELD` clause for the reference operator `$-` ## Performance tips -In Nebula Graph {{ nebula.release }}, pipes will affect the performance. Take `A | B` as an example, the effects are as follows: +In Nebula Graph, pipes will affect the performance. Take `A | B` as an example, the effects are as follows: 1. Pipe operators operate synchronously. That is, the data can enter the pipe clause as a whole after the execution of clause `A` before the pipe operator is completed. @@ -51,4 +53,4 @@ In Nebula Graph {{ nebula.release }}, pipes will affect the performance. Take `A 4. Every graphd process executes part of B. - This is usually much faster than executing a complete `A | B` with a single graphd process. \ No newline at end of file + This is usually much faster than executing a complete `A | B` with a single graphd process. diff --git a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md index e7b3a21e470..4507346be50 100644 --- a/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md +++ b/docs-2.0/3.ngql-guide/5.operators/5.property-reference.md @@ -9,7 +9,7 @@ Reference operators apply to native nGQL only. ## Reference operator List | Reference operator | Description | -|--------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------| +|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | `$^` | Refers to a source vertex property. For more information, see [Property reference](../4.variable-and-composite-queries/3.property-reference.md). | | `$$` | Refers to a destination vertex property. For more information, see [Property reference](../4.variable-and-composite-queries/3.property-reference.md). | | `$-` | Refers to the output of the statement before the pipe operator in a composite query. For more information, see [Pipe](4.pipe.md). | diff --git a/docs-2.0/3.ngql-guide/5.operators/6.set.md b/docs-2.0/3.ngql-guide/5.operators/6.set.md index 69496553bfe..9cd4a5a2d96 100644 --- a/docs-2.0/3.ngql-guide/5.operators/6.set.md +++ b/docs-2.0/3.ngql-guide/5.operators/6.set.md @@ -28,10 +28,11 @@ nebula> GO FROM "player102" OVER follow \ UNION \ GO FROM "player100" OVER follow; +-------------+ -| dst(edge) | +| follow._dst | +-------------+ +| "player100" | | "player101" | -| "player102" | +| "player125" | +-------------+ # The following statement returns the union of two query results with duplicated elements. @@ -39,11 +40,11 @@ nebula> GO FROM "player102" OVER follow \ UNION ALL \ GO FROM "player100" OVER follow; +-------------+ -| dst(edge) | +| follow._dst | +-------------+ +| "player100" | | "player101" | -| "player101" | -| "player102" | +| "player125" | +-------------+ # UNION can also work with the YIELD statement. The DISTINCT keyword will check duplication by all the columns for every line, and remove duplicated lines if every column is the same. @@ -80,7 +81,10 @@ nebula> GO FROM "player102" OVER follow \ INTERSECT \ GO FROM "player100" OVER follow \ YIELD dst(edge) AS id, properties(edge).degree AS Degree, properties($$).age AS Age; -Empty set (time spent 2990/3511 us) ++----+--------+-----+ +| id | Degree | Age | ++----+--------+-----+ ++----+--------+-----+ ``` ## MINUS @@ -100,13 +104,17 @@ nebula> GO FROM "player100" OVER follow \ +-------------+ | dst(edge) | +-------------+ -| "player102" | +| "player125" | +-------------+ nebula> GO FROM "player102" OVER follow \ MINUS \ GO FROM "player100" OVER follow; -Empty set (time spent 2243/3259 us) ++-------------+ +| follow._dst | ++-------------+ +| "player100" | ++-------------+ ``` ## Precedence of the set operators and pipe operators diff --git a/docs-2.0/3.ngql-guide/5.operators/7.string.md b/docs-2.0/3.ngql-guide/5.operators/7.string.md index ac8da3e6461..69d70226b69 100644 --- a/docs-2.0/3.ngql-guide/5.operators/7.string.md +++ b/docs-2.0/3.ngql-guide/5.operators/7.string.md @@ -21,11 +21,11 @@ You can use the following string operators for concatenating, querying, and matc ```ngql nebula> RETURN 'a' + 'b'; -+-------+ -| (a+b) | -+-------+ -| "ab" | -+-------+ ++-----------+ +| ("a"+"b") | ++-----------+ +| "ab" | ++-----------+ nebula> UNWIND 'a' AS a UNWIND 'b' AS b RETURN a + b; +-------+ | (a+b) | @@ -50,25 +50,25 @@ nebula> MATCH (s:player)-[e:serve]->(t:team) WHERE id(s) == "player101" \ nebula> GO FROM "player101" OVER serve WHERE (STRING)properties(edge).start_year CONTAINS "19" AND \ properties($^).name CONTAINS "ny" \ YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name; -+----------------+------------------+----------------+--------------+ ++---------------------+-----------------------------+---------------------------+---------------------+ | properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | -+----------------+------------------+----------------+--------------+ -| "Tony Parker" | 1999 | 2018 | "Spurs" | -+----------------+------------------+----------------+--------------+ ++---------------------+-----------------------------+---------------------------+---------------------+ +| "Tony Parker" | 1999 | 2018 | "Spurs" | ++---------------------+-----------------------------+---------------------------+---------------------+ nebula> GO FROM "player101" OVER serve WHERE !(properties($$).name CONTAINS "ets") \ - YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, $$.team.name; -+----------------+------------------+----------------+--------------+ + YIELD properties($^).name, properties(edge).start_year, properties(edge).end_year, properties($$).name; ++---------------------+-----------------------------+---------------------------+---------------------+ | properties($^).name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | -+----------------+------------------+----------------+--------------+ -| "Tony Parker" | 1999 | 2018 | "Spurs" | -+----------------+------------------+----------------+--------------+ ++---------------------+-----------------------------+---------------------------+---------------------+ +| "Tony Parker" | 1999 | 2018 | "Spurs" | ++---------------------+-----------------------------+---------------------------+---------------------+ ``` ### `(NOT) IN` ```ngql -nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi", "Tim", "Kobe"] +nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi", "Tim", "Kobe"]; +----------------+------------------------------------+-------------------------------+ | (1 IN [1,2,3]) | ("Yao" NOT IN ["Yi","Tim","Kobe"]) | (NULL IN ["Yi","Tim","Kobe"]) | +----------------+------------------------------------+-------------------------------+ @@ -79,14 +79,14 @@ nebula> RETURN 1 IN [1,2,3], "Yao" NOT IN ["Yi", "Tim", "Kobe"], NULL IN ["Yi", ### `(NOT) STARTS WITH` ```ngql -nebula> RETURN 'apple' STARTS WITH 'app', 'apple' STARTS WITH 'a', 'apple' STARTS WITH toUpper('a') +nebula> RETURN 'apple' STARTS WITH 'app', 'apple' STARTS WITH 'a', 'apple' STARTS WITH toUpper('a'); +-----------------------------+---------------------------+------------------------------------+ | ("apple" STARTS WITH "app") | ("apple" STARTS WITH "a") | ("apple" STARTS WITH toUpper("a")) | +-----------------------------+---------------------------+------------------------------------+ | true | true | false | +-----------------------------+---------------------------+------------------------------------+ -nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app' +nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app'; +---------------------------+---------------------------------+ | ("apple" STARTS WITH "b") | ("apple" NOT STARTS WITH "app") | +---------------------------+---------------------------------+ @@ -97,7 +97,7 @@ nebula> RETURN 'apple' STARTS WITH 'b','apple' NOT STARTS WITH 'app' ### `(NOT) ENDS WITH` ```ngql -nebula> RETURN 'apple' ENDS WITH 'app', 'apple' ENDS WITH 'e', 'apple' ENDS WITH 'E', 'apple' ENDS WITH 'b' +nebula> RETURN 'apple' ENDS WITH 'app', 'apple' ENDS WITH 'e', 'apple' ENDS WITH 'E', 'apple' ENDS WITH 'b'; +---------------------------+-------------------------+-------------------------+-------------------------+ | ("apple" ENDS WITH "app") | ("apple" ENDS WITH "e") | ("apple" ENDS WITH "E") | ("apple" ENDS WITH "b") | +---------------------------+-------------------------+-------------------------+-------------------------+ @@ -115,11 +115,11 @@ Nebula Graph supports filtering by using regular expressions. The regular expres ```ngql nebula> RETURN "384748.39" =~ "\\d+(\\.\\d{2})?"; -+----------------------------+ -| (384748.39=~\d+(\.\d{2})?) | -+----------------------------+ -| true | -+----------------------------+ ++--------------------------------+ +| ("384748.39"=~"\d+(\.\d{2})?") | ++--------------------------------+ +| true | ++--------------------------------+ nebula> MATCH (v:player) WHERE v.name =~ 'Tony.*' RETURN v.name; +---------------+ @@ -127,4 +127,4 @@ nebula> MATCH (v:player) WHERE v.name =~ 'Tony.*' RETURN v.name; +---------------+ | "Tony Parker" | +---------------+ -``` +``` \ No newline at end of file diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/14.geo.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/14.geo.md index c82e22e44ff..466df10c7a0 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/14.geo.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/14.geo.md @@ -24,7 +24,7 @@ For descriptions of the geography data types, see [Geography](../3.data-types/10 ## Examples ```ngql -nebula> RETURN ST_ASText(ST_Point(1,1)) +nebula> RETURN ST_ASText(ST_Point(1,1)); +--------------------------+ | ST_ASText(ST_Point(1,1)) | +--------------------------+ diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md index 1673171ce6d..3387b957b63 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/4.schema.md @@ -21,18 +21,18 @@ Nebula Graph supports the following schema functions. ## For statements compatible with openCypher -| Function | Description | -| :---- | :---- | -| id(\) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID. | -| list tags(\) | Returns the Tag of a vertex, which serves the same purpose as labels(). | -| list labels(\) | Returns the Tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax. | -| map properties(\) | Returns the properties of a vertex or an edge. | -| string type(\) | Returns the edge type of an edge. | -| src(\) | Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID. | -| dst(\) | Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID. | -| vertex startNode(\) | Visits an edge or a path and returns its source vertex ID. | -| string endNode(\) | Visits an edge or a path and returns its destination vertex ID. | -| int rank(\) | Returns the rank value of an edge. | +|Function| Description | +|:---- | :----| +| id() | Returns the ID of a vertex. The data type of the result is the same as the vertex ID.| +|list tags() | Returns the Tag of a vertex, which serves the same purpose as labels().| +|list labels() | Returns the Tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax.| +|map properties() | Returns the properties of a vertex or an edge.| +|string type() | Returns the edge type of an edge.| +|src()|Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|dst()|Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID.| +|vertex startNode() | Visits an edge or a path and returns its source vertex ID.| +|string endNode() | Visits an edge or a path and returns its destination vertex ID.| +|int rank() | Returns the rank value of an edge.| ## Examples diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md index 4d05ca3e6ce..e2a070b4221 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/5.case-expressions.md @@ -124,12 +124,12 @@ nebula> GO FROM "player100" OVER follow \ ELSE "No" \ END \ AS Age_above_35; -+---------------------+-----+--------------+ -| Name | Age | Age_above_35 | -+---------------------+-----+--------------+ -| "Tony Parker" | 36 | "No" | -| "LaMarcus Aldridge" | 33 | "No" | -+---------------------+-----+--------------+ ++-----------------+-----+--------------+ +| Name | Age | Age_above_35 | ++-----------------+-----+--------------+ +| "Tony Parker" | 36 | "No" | +| "Manu Ginobili" | 41 | "No" | ++-----------------+-----+--------------+ ``` The preceding `GO` query is intended to output `Yes` when the player's age is above 35. However, in this example, when the player's age is 36, the actual output is not as expected: It is `No` instead of `Yes`. diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md index df47a984ad9..21193a64e4f 100644 --- a/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/7.count.md @@ -14,7 +14,7 @@ count({expr | *}) - count(*) returns the number of rows (including NULL). -- count(expr) return the number of non-NULL values that meet the expression. +- count(expr) returns the number of non-NULL values that meet the expression. - `count()` and `size()` are different. @@ -38,12 +38,12 @@ nebula> GO FROM "player101" OVER follow BIDIRECT \ +---------------------+----------+ | $-.Name | count(*) | +---------------------+----------+ -| "Dejounte Murray" | 1 | | "LaMarcus Aldridge" | 2 | | "Tim Duncan" | 2 | | "Marco Belinelli" | 1 | | "Manu Ginobili" | 1 | | "Boris Diaw" | 1 | +| "Dejounte Murray" | 1 | +---------------------+----------+ ``` diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md index d164855c82b..1b234753d0e 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/2.match.md @@ -44,8 +44,8 @@ Make sure there is at least one index in the `MATCH` statement, or there is a sp ```ngql # The following example creates an index on both the name property of the tag player and the edge type follow. -nebula> CREATE TAG INDEX name ON player(name(20)); -nebula> CREATE EDGE INDEX follow_index on follow(); +nebula> CREATE TAG INDEX IF NOT EXISTS name ON player(name(20)); +nebula> CREATE EDGE INDEX IF NOT EXISTS follow_index on follow(); # The following example rebuilds the index. nebula> REBUILD TAG INDEX name; @@ -55,7 +55,7 @@ nebula> REBUILD TAG INDEX name; | 121 | +------------+ -nebula> REBUILD EDGE INDEX follow_index +nebula> REBUILD EDGE INDEX follow_index; +------------+ | New Job Id | +------------+ @@ -65,24 +65,24 @@ nebula> REBUILD EDGE INDEX follow_index # The following example makes sure the index is rebuilt successfully. nebula> SHOW JOB 121; -+----------------+---------------------+------------+-------------------------+-------------------------+ -| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | -+----------------+---------------------+------------+-------------------------+-------------------------+ -| 121 | "REBUILD_TAG_INDEX" | "FINISHED" | 2021-05-27T02:18:02.000 | 2021-05-27T02:18:02.000 | -| 0 | "storaged1" | "FINISHED" | 2021-05-27T02:18:02.000 | 2021-05-27T02:18:02.000 | -| 1 | "storaged0" | "FINISHED" | 2021-05-27T02:18:02.000 | 2021-05-27T02:18:02.000 | -| 2 | "storaged2" | "FINISHED" | 2021-05-27T02:18:02.000 | 2021-05-27T02:18:02.000 | -+----------------+---------------------+------------+-------------------------+-------------------------+ ++----------------+---------------------+------------+----------------------------+----------------------------+ +| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | ++----------------+---------------------+------------+----------------------------+----------------------------+ +| 121 | "REBUILD_TAG_INDEX" | "FINISHED" | 2021-05-27T02:18:02.000000 | 2021-05-27T02:18:02.000000 | +| 0 | "storaged1" | "FINISHED" | 2021-05-27T02:18:02.000000 | 2021-05-27T02:18:02.000000 | +| 1 | "storaged0" | "FINISHED" | 2021-05-27T02:18:02.000000 | 2021-05-27T02:18:02.000000 | +| 2 | "storaged2" | "FINISHED" | 2021-05-27T02:18:02.000000 | 2021-05-27T02:18:02.000000 | ++----------------+---------------------+------------+----------------------------+----------------------------+ nebula> SHOW JOB 122; -+----------------+----------------------+------------+-------------------------+-------------------------+ -| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | -+----------------+----------------------+------------+-------------------------+-------------------------+ -| 122 | "REBUILD_EDGE_INDEX" | "FINISHED" | 2021-05-27T02:18:11.000 | 2021-05-27T02:18:11.000 | -| 0 | "storaged1" | "FINISHED" | 2021-05-27T02:18:11.000 | 2021-05-27T02:18:21.000 | -| 1 | "storaged0" | "FINISHED" | 2021-05-27T02:18:11.000 | 2021-05-27T02:18:21.000 | -| 2 | "storaged2" | "FINISHED" | 2021-05-27T02:18:11.000 | 2021-05-27T02:18:21.000 | -+----------------+----------------------+------------+-------------------------+-------------------------+ ++----------------+----------------------+------------+----------------------------+----------------------------+ +| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | ++----------------+----------------------+------------+----------------------------+----------------------------+ +| 122 | "REBUILD_EDGE_INDEX" | "FINISHED" | 2021-05-27T02:18:11.000000 | 2021-05-27T02:18:11.000000 | +| 0 | "storaged1" | "FINISHED" | 2021-05-27T02:18:11.000000 | 2021-05-27T02:18:21.000000 | +| 1 | "storaged0" | "FINISHED" | 2021-05-27T02:18:11.000000 | 2021-05-27T02:18:21.000000 | +| 2 | "storaged2" | "FINISHED" | 2021-05-27T02:18:11.000000 | 2021-05-27T02:18:21.000000 | ++----------------+----------------------+------------+----------------------------+----------------------------+ ``` ### Match vertices @@ -98,14 +98,14 @@ You can use a user-defined variable in a pair of parentheses to represent a vert You can specify a tag with `:` after the vertex in a pattern. ```ngql -nebula> MATCH (v:player) RETURN v; +nebula> MATCH (v:player) \ + RETURN v; +---------------------------------------------------------------+ | v | +---------------------------------------------------------------+ -| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | -| ("player106" :player{age: 25, name: "Kyle Anderson"}) | -| ("player115" :player{age: 40, name: "Kobe Bryant"}) | -+---------------------------------------------------------------+ +| ("player105" :player{age: 31, name: "Danny Green"}) | +| ("player109" :player{age: 34, name: "Tiago Splitter"}) | +| ("player111" :player{age: 38, name: "David West"}) | ... ``` @@ -119,22 +119,25 @@ You can specify a vertex property with `{: }` after the t ```ngql # The following example uses the name property to match a vertex. -nebula> MATCH (v:player{name:"Tim Duncan"}) RETURN v; +nebula> MATCH (v:player{name:"Tim Duncan"}) \ + RETURN v; +----------------------------------------------------+ | v | +----------------------------------------------------+ -| ("player100" :player{name: "Tim Duncan", age: 42}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ ``` The `WHERE` clause can do the same thing: ```ngql -nebula> MATCH (v:player) WHERE v.name == "Tim Duncan" RETURN v; +nebula> MATCH (v:player) \ + WHERE v.name == "Tim Duncan" \ + RETURN v; +----------------------------------------------------+ | v | +----------------------------------------------------+ -| ("player100" :player{name: "Tim Duncan", age: 42}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ ``` @@ -147,7 +150,9 @@ nebula> MATCH (v:player) WHERE v.name == "Tim Duncan" RETURN v; You can use the VID to match a vertex. The `id()` function can retrieve the VID of a vertex. ```ngql -nebula> MATCH (v) WHERE id(v) == 'player101' RETURN v; +nebula> MATCH (v) \ + WHERE id(v) == 'player101' \ + RETURN v; +-----------------------------------------------------+ | v | +-----------------------------------------------------+ @@ -159,13 +164,14 @@ To match multiple VIDs, use `WHERE id(v) IN [vid_list]`. ```ngql nebula> MATCH (v:player { name: 'Tim Duncan' })--(v2) \ - WHERE id(v2) IN ["player101", "player102"] RETURN v2; + WHERE id(v2) IN ["player101", "player102"] \ + RETURN v2; +-----------------------------------------------------------+ | v2 | +-----------------------------------------------------------+ -| ("player101" :player{name: "Tony Parker", age: 36}) | -| ("player102" :player{name: "LaMarcus Aldridge", age: 33}) | -| ("player101" :player{name: "Tony Parker", age: 36}) | +| ("player101" :player{age: 36, name: "Tony Parker"}) | +| ("player101" :player{age: 36, name: "Tony Parker"}) | +| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | +-----------------------------------------------------------+ ``` @@ -183,12 +189,10 @@ nebula> MATCH (v:player{name:"Tim Duncan"})--(v2) \ +---------------------+ | Name | +---------------------+ +| "Spurs" | | "Tony Parker" | | "LaMarcus Aldridge" | | "Marco Belinelli" | -| "Danny Green" | -| "Aron Baynes" | -+---------------------+ ... ``` @@ -216,12 +220,9 @@ nebula> MATCH (v:player{name:"Tim Duncan"})-->(v2)<--(v3) \ +---------------------+ | Name | +---------------------+ -| "Tony Parker" | -| "Tiago Splitter" | | "Dejounte Murray" | -| "Tony Parker" | | "LaMarcus Aldridge" | -+---------------------+ +| "Marco Belinelli" | ... ``` @@ -233,12 +234,9 @@ nebula> MATCH (v:player{name:"Tim Duncan"})-->()<--(v3) \ +---------------------+ | Name | +---------------------+ -| "Tony Parker" | +| "Dejounte Murray" | | "LaMarcus Aldridge" | -| "Rudy Gay" | -| "Danny Green" | -| "Kyle Anderson" | -+---------------------+ +| "Marco Belinelli" | ... ``` @@ -249,13 +247,13 @@ Connected vertices and edges form a path. You can use a user-defined variable to ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-->(v2) \ RETURN p; -+-------------------------------------------+ -| p | -+-------------------------------------------+ ++--------------------------------------------------------------------------------------------------------------------------------------+ +| p | ++--------------------------------------------------------------------------------------------------------------------------------------+ +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:serve@0 {end_year: 2016, start_year: 1997}]->("team204" :team{name: "Spurs"})> | | <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})> | | <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})> | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:serve@0 {end_year: 2016, start_year: 1997}]->("team204" :team{name: "Spurs"})> | -+-------------------------------------------+ ++--------------------------------------------------------------------------------------------------------------------------------------+ ``` !!! compatibility "OpenCypher compatibility" @@ -269,13 +267,12 @@ Besides using `--`, `-->`, or `<--` to indicate a nameless edge, you can use a u ```ngql nebula> MATCH (v:player{name:"Tim Duncan"})-[e]-(v2) \ RETURN e; -+---------------------------------------------------------------------------+ -| e | -+---------------------------------------------------------------------------+ -| [:follow "player101"->"player100" @0 {degree: 95}] | -| [:follow "player102"->"player100" @0 {degree: 75}] | -| [:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}] | -+---------------------------------------------------------------------------+ ++-----------------------------------------------------------------------+ +| e | ++-----------------------------------------------------------------------+ +| [:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}] | +| [:follow "player101"->"player100" @0 {degree: 95}] | +| [:follow "player102"->"player100" @0 {degree: 75}] | ... ``` @@ -289,12 +286,9 @@ nebula> MATCH ()-[e:follow]-() \ +-----------------------------------------------------+ | e | +-----------------------------------------------------+ -| [:follow "player113"->"player119" @0 {degree: 99}] | -| [:follow "player130"->"player149" @0 {degree: 80}] | -| [:follow "player149"->"player130" @0 {degree: 80}] | -| [:follow "player136"->"player117" @0 {degree: 90}] | -| [:follow "player142"->"player117" @0 {degree: 90}] | -+-----------------------------------------------------+ +| [:follow "player104"->"player105" @0 {degree: 60}] | +| [:follow "player113"->"player105" @0 {degree: 99}] | +| [:follow "player105"->"player100" @0 {degree: 70}] | ... ``` @@ -340,13 +334,12 @@ You can extend a pattern to match multiple edges in a path. ```ngql nebula> MATCH (v:player{name:"Tim Duncan"})-[]->(v2)<-[e:serve]-(v3) \ RETURN v2, v3; -+------------------------------------+-----------------------------------------------------------+ -| v2 | v3 | -+------------------------------------+-----------------------------------------------------------+ -| ("player204" :team{name: "Spurs"}) | ("player101" :player{name: "Tony Parker", age: 36}) | -| ("player204" :team{name: "Spurs"}) | ("player102" :player{name: "LaMarcus Aldridge", age: 33}) | -| ("player204" :team{name: "Spurs"}) | ("player103" :player{age: 32, name: "Rudy Gay"}) | -+------------------------------------+-----------------------------------------------------------+ ++----------------------------------+-----------------------------------------------------------+ +| v2 | v3 | ++----------------------------------+-----------------------------------------------------------+ +| ("team204" :team{name: "Spurs"}) | ("player104" :player{age: 32, name: "Marco Belinelli"}) | +| ("team204" :team{name: "Spurs"}) | ("player101" :player{age: 36, name: "Tony Parker"}) | +| ("team204" :team{name: "Spurs"}) | ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | ... ``` @@ -360,9 +353,9 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) \ +-----------------------------------------------------------+ | Friends | +-----------------------------------------------------------+ -| ("player100" :player{name: "Tim Duncan", age: 42}) | -| ("player102" :player{name: "LaMarcus Aldridge", age: 33}) | -| ("player125" :player{name: "Manu Ginobili", age: 41}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +| ("player125" :player{age: 41, name: "Manu Ginobili"}) | +| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | +-----------------------------------------------------------+ ``` @@ -378,6 +371,34 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) -[*0]-> (v2) \ +----------------------------------------------------+ ``` +!!! Note + + When you conditionally filter on multi-hop edges, such as `-[e:follow*2]->`, note that the `e` is a list of edges instead of a single edge. + + For example, the following statement is correct from the syntax point of view which may not get your expected query result, because the `e` is a list without the `.degree` property. + + ```ngql + nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) \ + WHERE e.degree > 1 \ + RETURN DISTINCT v2 AS Friends; + ``` + + The correct statement is as follows: + + ```ngql + nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) \ + WHERE ALL(e_ in e WHERE e_.degree > 0) \ + RETURN DISTINCT v2 AS Friends; + ``` + + Further, the following statement is for filtering the properties of the first-hop edge in multi-hop edges: + + ```ngql + nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) \ + WHERE e[0].degree > 98 \ + RETURN DISTINCT v2 AS Friends; + ``` + ### Match variable-length paths You can use the `:*[minHop]..` pattern to match variable-length paths. @@ -397,11 +418,10 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) \ +-----------------------------------------------------------+ | Friends | +-----------------------------------------------------------+ -| ("player100" :player{age: 42, name: "Tim Duncan"}) | | ("player101" :player{age: 36, name: "Tony Parker"}) | | ("player125" :player{age: 41, name: "Manu Ginobili"}) | -| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | -+-----------------------------------------------------------+ +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +... ``` You can use the `DISTINCT` keyword to aggregate duplicate results. @@ -412,10 +432,10 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2:player) \ +-----------------------------------------------------------+-----------+ | Friends | count(v2) | +-----------------------------------------------------------+-----------+ -| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 | | ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | 1 | | ("player100" :player{age: 42, name: "Tim Duncan"}) | 4 | | ("player101" :player{age: 36, name: "Tony Parker"}) | 3 | +| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 | +-----------------------------------------------------------+-----------+ ``` @@ -427,10 +447,10 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*0..3]->(v2:player) \ +-----------------------------------------------------------+-----------+ | Friends | count(v2) | +-----------------------------------------------------------+-----------+ -| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 | -| ("player101" :player{age: 36, name: "Tony Parker"}) | 3 | | ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | 1 | | ("player100" :player{age: 42, name: "Tim Duncan"}) | 5 | +| ("player125" :player{age: 41, name: "Manu Ginobili"}) | 3 | +| ("player101" :player{age: 36, name: "Tony Parker"}) | 3 | +-----------------------------------------------------------+-----------+ ``` @@ -444,11 +464,11 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow|serve*2]->(v2) \ +-----------------------------------------------------------+ | v2 | +-----------------------------------------------------------+ -| ("player100" :player{name: "Tim Duncan", age: 42}) | -| ("player102" :player{name: "LaMarcus Aldridge", age: 33}) | -| ("player125" :player{name: "Manu Ginobili", age: 41}) | -| ("player204" :team{name: "Spurs"}) | -| ("player215" :team{name: "Hornets"}) | +| ("team204" :team{name: "Spurs"}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +| ("team215" :team{name: "Hornets"}) | +| ("player125" :player{age: 41, name: "Manu Ginobili"}) | +| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | +-----------------------------------------------------------+ ``` @@ -464,18 +484,18 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) \ +----------------------------------------------------+ | v | +----------------------------------------------------+ -| ("player100" :player{name: "Tim Duncan", age: 42}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +----------------------------------------------------+ nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) \ RETURN e; -+---------------------------------------------------------------------------+ -| e | -+---------------------------------------------------------------------------+ -| [:follow "player100"->"player101" @0 {degree: 95}] | -| [:follow "player100"->"player125" @0 {degree: 95}] | -| [:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}] | -+---------------------------------------------------------------------------+ ++-----------------------------------------------------------------------+ +| e | ++-----------------------------------------------------------------------+ +| [:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}] | +| [:follow "player100"->"player101" @0 {degree: 95}] | +| [:follow "player100"->"player125" @0 {degree: 95}] | ++-----------------------------------------------------------------------+ ``` ### Retrieve VIDs @@ -551,13 +571,13 @@ Use the `properties()` function to retrieve all properties on a vertex or an edg ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-[]->(v2) \ RETURN properties(v2); -+------------------------------------+ -| properties(v2) | -+------------------------------------+ -| {"name":"Spurs"} | -| {"name":"Tony Parker", "age":36} | -| {"age":41, "name":"Manu Ginobili"} | -+------------------------------------+ ++----------------------------------+ +| properties(v2) | ++----------------------------------+ +| {name: "Spurs"} | +| {age: 36, name: "Tony Parker"} | +| {age: 41, name: "Manu Ginobili"} | ++----------------------------------+ ``` ### Retrieve edge types @@ -570,8 +590,8 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e]->() \ +----------+ | type(e) | +----------+ -| "follow" | | "serve" | +| "follow" | +----------+ ``` @@ -582,13 +602,13 @@ Use `RETURN ` to retrieve all the information of the matched paths. ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-[*3]->() \ RETURN p; -+-------------------------------------------------------------------------------------------------+ -| p | -+-------------------------------------------------------------------------------------------------+ -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:serve@0 {end_year: 2019, start_year: 2015}]->("team204" :team{name: "Spurs"})> | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:serve@0 {end_year: 2015, start_year: 2006}]->("team203" :team{name: "Trail Blazers"})> | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:follow@0 {degree: 75}]->("player101" :player{age: 36, name: "Tony Parker"})> | -+-------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| p | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:serve@0 {end_year: 2019, start_year: 2015}]->("team204" :team{name: "Spurs"})> | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:serve@0 {end_year: 2015, start_year: 2006}]->("team203" :team{name: "Trail Blazers"})> | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})-[:follow@0 {degree: 75}]->("player101" :player{age: 36, name: "Tony Parker"})> | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ... ``` @@ -615,13 +635,13 @@ Use the `relationships()` function to retrieve all edges in a path. ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-[]->(v2) \ RETURN relationships(p); -+-----------------------------------------------------------------------------+ -| relationships(p) | -+-----------------------------------------------------------------------------+ -| [[:follow "player100"->"player101" @0 {degree: 95}]] | -| [[:follow "player100"->"player125" @0 {degree: 95}]] | -| [[:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}]] | -+-----------------------------------------------------------------------------+ ++-------------------------------------------------------------------------+ +| relationships(p) | ++-------------------------------------------------------------------------+ +| [[:serve "player100"->"team204" @0 {end_year: 2016, start_year: 1997}]] | +| [[:follow "player100"->"player101" @0 {degree: 95}]] | +| [[:follow "player100"->"player125" @0 {degree: 95}]] | ++-------------------------------------------------------------------------+ ``` ### Retrieve path length @@ -631,23 +651,22 @@ Use the `length()` function to retrieve the length of a path. ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-[*..2]->(v2) \ RETURN p AS Paths, length(p) AS Length; -+----------------------------------------------------------------------+--------+ -| Paths | Length | -+----------------------------------------------------------------------+--------+ -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})-[:serve@0 {end_year: 2018, start_year: 2002}]->("team204" :team{name: "Spurs"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})-[:follow@0 {degree: 90}]->("player100" :player{age: 42, name: "Tim Duncan"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:serve@0 {end_year: 2019, start_year: 2018}]->("team215" :team{name: "Hornets"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:serve@0 {end_year: 2018, start_year: 1999}]->("team204" :team{name: "Spurs"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})> | 2 | -| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 95}]->("player100" :player{age: 42, name: "Tim Duncan"})> | 2 | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+ +| Paths | Length | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+ | <("player100" :player{age: 42, name: "Tim Duncan"})-[:serve@0 {end_year: 2016, start_year: 1997}]->("team204" :team{name: "Spurs"})> | 1 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})> | 1 | | <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})> | 1 | -+----------------------------------------------------------------------+--------+ +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:serve@0 {end_year: 2018, start_year: 1999}]->("team204" :team{name: "Spurs"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:serve@0 {end_year: 2019, start_year: 2018}]->("team215" :team{name: "Hornets"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 95}]->("player100" :player{age: 42, name: "Tim Duncan"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 90}]->("player102" :player{age: 33, name: "LaMarcus Aldridge"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player101" :player{age: 36, name: "Tony Parker"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})-[:serve@0 {end_year: 2018, start_year: 2002}]->("team204" :team{name: "Spurs"})> | 2 | +| <("player100" :player{age: 42, name: "Tim Duncan"})-[:follow@0 {degree: 95}]->("player125" :player{age: 41, name: "Manu Ginobili"})-[:follow@0 {degree: 90}]->("player100" :player{age: 42, name: "Tim Duncan"})> | 2 | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------+ ``` !!! Performance - In Nebula Graph {{ nebula.release }}, the `MATCH` statement has initially optimized for resource usage and performance. - - Simpler operations can be replaced by `GO`, `LOOKUP`, `|`, and `FETCH`. + In Nebula Graph, the performance and resource usage of the `MATCH` statement have been optimized. But we still recommend to use `GO`, `LOOKUP`, `|`, and `FETCH` instead of `MATCH` when high performance is required. diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md b/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md index 5b705b6d840..f58366e64d6 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/3.go.md @@ -152,9 +152,9 @@ nebula> GO FROM "player100" OVER follow REVERSELY \ +---------------------+-----------------+ | FriendOf | Team | +---------------------+-----------------+ -| "Danny Green" | "Spurs" | -| "Danny Green" | "Cavaliers" | -+---------------------+-----------------+ +| "Boris Diaw" | "Spurs" | +| "Boris Diaw" | "Jazz" | +| "Boris Diaw" | "Suns" | ... # This MATCH query shares the same semantics with the preceding GO query. @@ -164,34 +164,9 @@ nebula> MATCH (v)<-[e:follow]- (v2)-[e2:serve]->(v3) \ +---------------------+-----------------+ | FriendOf | Team | +---------------------+-----------------+ -| "Tony Parker" | "Spurs" | -| "Tony Parker" | "Hornets" | -+---------------------+-----------------+ -... -``` - -```ngql -# The following example returns all the neighbor vertices of player 102. -nebula> GO FROM "player102" OVER follow \ - YIELD dst(edge) AS both; -+-------------+ -| both | -+-------------+ -| "player100" | -| "player101" | -+-------------+ -... - -# This MATCH query shares the same semantics with the preceding GO query. -nebula> MATCH (v) -[e:follow]-(v2) \ - WHERE id(v)== "player102" \ - RETURN id(v2) AS both; -+-------------+ -| both | -+-------------+ -| "player101" | -| "player103" | -+-------------+ +| "Boris Diaw" | "Spurs" | +| "Boris Diaw" | "Jazz" | +| "Boris Diaw" | "Suns" | ... ``` @@ -204,7 +179,6 @@ nebula> GO 1 TO 2 STEPS FROM "player100" OVER follow \ +-------------+ | "player101" | | "player125" | -+-------------+ ... # This MATCH query shares the same semantics with the preceding GO query. @@ -216,7 +190,7 @@ nebula> MATCH (v) -[e:follow*1..2]->(v2) \ +-------------+ | "player100" | | "player102" | -+-------------+ +... ``` ```ngql diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md index 794d227d685..34b4aea1384 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/4.fetch.md @@ -74,7 +74,7 @@ Specify multiple tags in the `FETCH` statement to fetch the vertex properties by ```ngql # The following example creates a new tag t1. -nebula> CREATE TAG t1(a string, b int); +nebula> CREATE TAG IF NOT EXISTS t1(a string, b int); # The following example attaches t1 to the vertex "player100". nebula> INSERT VERTEX t1(a, b) VALUE "player100":("Hello", 100); diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md index 74fad0cef10..f055273e382 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md @@ -62,12 +62,12 @@ The `WHERE` clause in a `LOOKUP` statement does not support the following operat - The `XOR` and `NOT` operations are not supported. -## Retrieve Vertices +## Retrieve vertices The following example returns vertices whose `name` is `Tony Parker` and the tag is `player`. ```ngql -nebula> CREATE TAG INDEX index_player ON player(name(30), age); +nebula> CREATE TAG INDEX IF NOT EXISTS index_player ON player(name(30), age); nebula> REBUILD TAG INDEX index_player; +------------+ @@ -98,8 +98,8 @@ nebula> LOOKUP ON player \ +-------------+ | VertexID | +-------------+ -| "player144" | | "player140" | +| "player144" | +-------------+ nebula> LOOKUP ON player \ @@ -109,28 +109,28 @@ nebula> LOOKUP ON player \ +-------------+-------------------------+------------------------+ | VertexID | properties(VERTEX).name | properties(VERTEX).age | +-------------+-------------------------+------------------------+ -| "player149" | "Ben Simmons" | 22 | | "player134" | "Blake Griffin" | 30 | +| "player149" | "Ben Simmons" | 22 | +-------------+-------------------------+------------------------+ nebula> LOOKUP ON player \ - WHERE player.name == "Kobe Bryant" \ + WHERE player.name == "Kobe Bryant"\ YIELD properties(vertex).name AS name |\ GO FROM $-.VertexID OVER serve \ YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; -+---------------+------------------+----------------+--------------+ -| $-.name | serve.start_year | serve.end_year | $$.team.name | -+---------------+------------------+----------------+--------------+ -| "Kobe Bryant" | 1996 | 2016 | "Lakers" | -+---------------+------------------+----------------+--------------+ ++---------------+-----------------------------+---------------------------+---------------------+ +| $-.name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | ++---------------+-----------------------------+---------------------------+---------------------+ +| "Kobe Bryant" | 1996 | 2016 | "Lakers" | ++---------------+-----------------------------+---------------------------+---------------------+ ``` -## Retrieve Edges +## Retrieve edges The following example returns edges whose `degree` is `90` and the edge type is `follow`. ```ngql -nebula> CREATE EDGE INDEX index_follow ON follow(degree); +nebula> CREATE EDGE INDEX IF NOT EXISTS index_follow ON follow(degree); nebula> REBUILD EDGE INDEX index_follow; +------------+ @@ -144,10 +144,9 @@ nebula> LOOKUP ON follow \ +-------------+-------------+---------+ | SrcVID | DstVID | Ranking | +-------------+-------------+---------+ -| "player101" | "player102" | 0 | -| "player133" | "player114" | 0 | -| "player133" | "player144" | 0 | -+-------------+-------------+---------+ +| "player150" | "player143" | 0 | +| "player150" | "player137" | 0 | +| "player148" | "player136" | 0 | ... nebula> LOOKUP ON follow \ @@ -156,10 +155,9 @@ nebula> LOOKUP ON follow \ +-------------+-------------+---------+-------------------------+ | SrcVID | DstVID | Ranking | properties(EDGE).degree | +-------------+-------------+---------+-------------------------+ -| "player121" | "player116" | 0 | 90 | -| "player121" | "player128" | 0 | 90 | -| "player121" | "player129" | 0 | 90 | -+-------------+-------------+---------+-------------------------+ +| "player150" | "player143" | 0 | 90 | +| "player150" | "player137" | 0 | 90 | +| "player148" | "player136" | 0 | 90 | ... nebula> LOOKUP ON follow \ @@ -185,9 +183,9 @@ For example, if there is a `player` tag with a `name` property and an `age` prop - The following example shows how to retrieve the VID of all vertices tagged with `player`. ```ngql - nebula> CREATE TAG player(name string,age int); + nebula> CREATE TAG IF NOT EXISTS player(name string,age int); - nebula> CREATE TAG INDEX player_index on player(); + nebula> CREATE TAG INDEX IF NOT EXISTS player_index on player(); nebula> REBUILD TAG INDEX player_index; +------------+ @@ -210,36 +208,36 @@ For example, if there is a `player` tag with a `name` property and an `age` prop +-------------+ ``` -- The following example shows how to retrieve the source Vertex IDs, destination vertex IDs, and ranks of all edges of the `like` edge type. +- The following example shows how to retrieve the source Vertex IDs, destination vertex IDs, and ranks of all edges of the `follow` edge type. ```ngql - nebula> CREATE EDGE like(likeness int); + nebula> CREATE EDGE IF NOT EXISTS follow(degree int); - nebula> CREATE EDGE INDEX like_index on like(); + nebula> CREATE EDGE INDEX IF NOT EXISTS follow_index on follow(); - nebula> REBUILD EDGE INDEX like_index; + nebula> REBUILD EDGE INDEX follow_index; +------------+ | New Job Id | +------------+ | 88 | +------------+ - nebula> INSERT EDGE like(likeness) \ + nebula> INSERT EDGE follow(degree) \ VALUES "player100"->"player101":(95); - The following statement retrieves all edges with the edge type `like`. It is similar to `MATCH (s)-[e:like]->(d) RETURN id(s), rank(e), id(d) /*, type(e) */`. + The following statement retrieves all edges with the edge type `follow`. It is similar to `MATCH (s)-[e:follow]->(d) RETURN id(s), rank(e), id(d) /*, type(e) */`. - nebula)> LOOKUP ON like; - +-------------+----------+-------------+ - | VertexID | DstVID | _dst | - +-------------+----------+-------------+ - | "player100" | 0 | "player101" | - +-------------+----------+-------------+ + nebula)> LOOKUP ON follow; + +-------------+-------------+---------+ + | SrcVID | DstVID | Ranking | + +-------------+-------------+---------+ + | "player100" | "player101" | 0 | + +-------------+-------------+---------+ ``` ## Count the numbers of vertices or edges -The following example shows how to count the number of vertices tagged with `player` and edges of the `like` edge type. +The following example shows how to count the number of vertices tagged with `player` and edges of the `follow` edge type. ```ngql nebula> LOOKUP ON player |\ @@ -247,18 +245,18 @@ nebula> LOOKUP ON player |\ +---------------+ | Player_Number | +---------------+ -| 2 | +| 51 | +---------------+ -nebula> LOOKUP ON like | \ - YIELD COUNT(*) AS Like_Number; -+-------------+ -| Like_Number | -+-------------+ -| 1 | -+-------------+ +nebula> LOOKUP ON follow | \ + YIELD COUNT(*) AS Follow_Number; ++---------------+ +| Follow_Number | ++---------------+ +| 81 | ++---------------+ ``` !!! note - You can also use [`show-stats`](./6.show/14.show-stats.md) to count the numbers of vertices or edges. + You can also use [`SHOW STATS`](./6.show/14.show-stats.md) to count the numbers of vertices or edges. diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md index b31919138f0..5673520be8f 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/14.show-stats.md @@ -39,14 +39,14 @@ nebula> SUBMIT JOB STATS; # Make sure the job executes successfully. nebula> SHOW JOB 98; -+----------------+---------------+------------+------------+------------+ -| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | -+----------------+---------------+------------+------------+------------+ -| 98 | "STATS" | "FINISHED" | 1606552675 | 1606552675 | -| 0 | "storaged2" | "FINISHED" | 1606552675 | 1606552675 | -| 1 | "storaged0" | "FINISHED" | 1606552675 | 1606552675 | -| 2 | "storaged1" | "FINISHED" | 1606552675 | 1606552675 | -+----------------+---------------+------------+------------+------------+ ++----------------+---------------+------------+----------------------------+----------------------------+ +| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time | ++----------------+---------------+------------+----------------------------+----------------------------+ +| 98 | "STATS" | "FINISHED" | 2021-11-01T09:33:21.000000 | 2021-11-01T09:33:21.000000 | +| 0 | "storaged2" | "FINISHED" | 2021-11-01T09:33:21.000000 | 2021-11-01T09:33:21.000000 | +| 1 | "storaged0" | "FINISHED" | 2021-11-01T09:33:21.000000 | 2021-11-01T09:33:21.000000 | +| 2 | "storaged1" | "FINISHED" | 2021-11-01T09:33:21.000000 | 2021-11-01T09:33:21.000000 | ++----------------+---------------+------------+----------------------------+----------------------------+ # Show the statistics of the graph space. nebula> SHOW STATS; @@ -55,7 +55,7 @@ nebula> SHOW STATS; +---------+------------+-------+ | "Tag" | "player" | 51 | | "Tag" | "team" | 30 | -| "Edge" | "like" | 81 | +| "Edge" | "follow" | 81 | | "Edge" | "serve" | 152 | | "Space" | "vertices" | 81 | | "Space" | "edges" | 233 | diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md index 68116bbd32d..b3d5adbd6a8 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/15.show-tags-edges.md @@ -23,10 +23,10 @@ nebula> SHOW TAGS; +----------+ nebula> SHOW EDGES; -+---------+ -| Name | -+---------+ -| "like" | -| "serve" | -+---------+ ++----------+ +| Name | ++----------+ +| "follow" | +| "serve" | ++----------+ ``` diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md index 042935f5764..ea03a69eea7 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md @@ -21,26 +21,34 @@ SHOW SESSION ; ```ngql nebula> SHOW SESSIONS; -+------------------+----------+--------------------+----------------------------+----------------------------+---------------+----------+----------------+ -| SessionId | UserName | SpaceName | CreateTime | UpdateTime | GraphAddr | Timezone | ClientIp | -+------------------+----------+--------------------+----------------------------+----------------------------+---------------+----------+----------------+ -| 1623305056644097 | "user1" | "" | 2021-06-10T06:04:16.644097 | 2021-06-10T06:04:16.638039 | "graphd:9669" | 0 | "172.22.xx.xx" | -| 1623304491050858 | "root" | "basketballplayer" | 2021-06-10T05:54:51.50858 | 2021-06-10T06:17:31.5417 | "graphd:9669" | 0 | "172.22.xx.xx" | -+------------------+----------+--------------------+----------------------------+----------------------------+---------------+----------+----------------+ - -nebula> SHOW SESSION 1623304491050858; -+--------------+-----------------------------+ -| VariableName | Value | -+--------------+-----------------------------+ -| "SessionID" | 1623304491050858 | -| "UserName" | "root" | -| "SpaceName" | "basketballplayer" | -| "CreateTime" | 2021-06-10T05:54:51.50858 | -| "UpdateTime" | 2021-06-10T06:17:34.866137 | -| "GraphAddr" | "graphd:9669" | -| "Timezone" | 0 | -| "ClientIp" | "172.22.xx.xx" | -+--------------+-----------------------------+ ++------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+ +| SessionId | UserName | SpaceName | CreateTime | UpdateTime | GraphAddr | Timezone | ClientIp | ++------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+ +| 1635128818397714 | "root" | "test" | 2021-10-25T02:26:58.397714 | 2021-10-25T08:31:31.846846 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1635254859271703 | "root" | "basketballplayer" | 2021-10-26T13:27:39.271703 | 2021-10-26T13:51:38.277704 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1634871229727322 | "root" | "basketballplayer" | 2021-10-22T02:53:49.727322 | 2021-10-22T02:53:56.564001 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1635750725840229 | "root" | "basketballplayer" | 2021-11-01T07:12:05.840229 | 2021-11-01T09:42:36.883617 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1635299224732060 | "root" | "basketballplayer" | 2021-10-27T01:47:04.732060 | 2021-10-27T09:04:31.741126 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1634628999765689 | "root" | "" | 2021-10-19T07:36:39.765689 | 2021-10-19T07:36:39.768064 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1634886296595136 | "root" | "basketballplayer" | 2021-10-22T07:04:56.595136 | 2021-10-22T09:48:20.299364 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1634629179882439 | "root" | "basketballplayer" | 2021-10-19T07:39:39.882439 | 2021-10-19T09:34:52.153145 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1635246158961634 | "root" | "basketballplayer" | 2021-10-26T11:02:38.961634 | 2021-10-26T11:02:51.250897 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | +| 1634785346839017 | "root" | "basketballplayer" | 2021-10-21T03:02:26.839017 | 2021-10-21T11:07:40.911329 | "127.0.0.1:9669" | 0 | "::ffff:127.0.0.1" | ++------------------+----------+--------------------+----------------------------+----------------------------+------------------+----------+--------------------+ + +nebula> SHOW SESSION 1635254859271703; ++--------------+----------------------------+ +| VariableName | Value | ++--------------+----------------------------+ +| "SessionID" | 1635254859271703 | +| "UserName" | "root" | +| "SpaceName" | "basketballplayer" | +| "CreateTime" | 2021-10-26T13:27:39.271703 | +| "UpdateTime" | 2021-10-26T13:51:38.277704 | +| "GraphAddr" | "127.0.0.1:9669" | +| "Timezone" | 0 | +| "ClientIp" | "::ffff:127.0.0.1" | ++--------------+----------------------------+ ``` | Parameter | Description | diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md index 6c390d3de36..a2dafaeaf36 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/4.show-create-space.md @@ -14,9 +14,9 @@ SHOW CREATE SPACE ; ```ngql nebula> SHOW CREATE SPACE basketballplayer; -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ -| Space | Create Space | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ -| "basketballplayer" | "CREATE SPACE `basketballplayer` (partition_num = 10, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(32))" | -+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ -``` \ No newline at end of file ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Space | Create Space | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ +| "basketballplayer" | "CREATE SPACE `basketballplayer` (partition_num = 10, replica_factor = 1, charset = utf8, collate = utf8_bin, vid_type = FIXED_STRING(32)) ON default" | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ +``` diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tags-edges.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tag-edge.md similarity index 96% rename from docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tags-edges.md rename to docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tag-edge.md index 16de3e293dc..1f7d73d1a46 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tags-edges.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/5.show-create-tag-edge.md @@ -20,7 +20,7 @@ nebula> SHOW CREATE TAG player; | "player" | "CREATE TAG `player` ( | | | `name` string NULL, | | | `age` int64 NULL | -| | ) ttl_duration = 0, ttl_col = "" | +| | ) ttl_duration = 0, ttl_col = """ | +----------+-----------------------------------+ nebula> SHOW CREATE EDGE follow; diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md index bd9ba11e689..078a9ab0efb 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/6.show-hosts.md @@ -8,44 +8,49 @@ The `SHOW HOSTS` statement shows the host and version information of Graph Servi SHOW HOSTS [GRAPH | STORAGE | META]; ``` -If you return `SHOW HOSTS` without the service name, it will show the host information of Storage Service, as well as the leader number, leader distribution, and partition distribution. +!!! note + + - If you return `SHOW HOSTS` without the service name, it will show the host information of the Storage Service, as well as the leader number, leader distribution, and partition distribution. + + - For a Nebula Graph cluster installed with the source code, the version of the cluster will not be displayed in the output after executing the command `SHOW HOSTS (GRAPH | STORAGE | META)` with the service name. + ## Examples ```ngql nebula> SHOW HOSTS; -+-------------+-------+----------+--------------+----------------------------------+-----------------------------+ -| Host | Port | Status | Leader count | Leader distribution | Partition distribution | -+-------------+-------+----------+--------------+----------------------------------+-----------------------------+ -| "storaged0" | 9779 | "ONLINE" | 8 | "docs:5, basketballplayer:3" | "docs:5, basketballplayer:3"| -| "storaged1" | 9779 | "ONLINE" | 9 | "basketballplayer:4, docs:5" | "docs:5, basketballplayer:4"| -| "storaged2" | 9779 | "ONLINE" | 8 | "basketballplayer:3, docs:5" | "docs:5, basketballplayer:3"| -+-------------+-------+----------+--------------+----------------------------------+-----------------------------+ ++-------------+-------+----------+--------------+----------------------------------+------------------------------+ +| Host | Port | Status | Leader count | Leader distribution | Partition distribution | ++-------------+-------+----------+--------------+----------------------------------+------------------------------+ +| "storaged0" | 9779 | "ONLINE" | 8 | "docs:5, basketballplayer:3" | "docs:5, basketballplayer:3" | +| "storaged1" | 9779 | "ONLINE" | 9 | "basketballplayer:4, docs:5" | "docs:5, basketballplayer:4" | +| "storaged2" | 9779 | "ONLINE" | 8 | "basketballplayer:3, docs:5" | "docs:5, basketballplayer:3" | ++-------------+-------+----------+--------------+----------------------------------+------------------------------+ nebula> SHOW HOSTS GRAPH; -+-----------+------+----------+---------+---------------+------------------------------------------+ -| Host | Port | Status | Role | Git Info Sha | Version | -+-----------+------+----------+---------+--------------+-------------------------------------------+ -| "graphd" | 9669 | "ONLINE" | "GRAPH" | "c397299c" | "2.5.0, Build Time: Aug 19 2021 11:20:18" | -| "graphd1" | 9669 | "ONLINE" | "GRAPH" | "c397299c" | "2.5.0, Build Time: Aug 19 2021 11:20:18" | -| "graphd2" | 9669 | "ONLINE" | "GRAPH" | "c397299c" | "2.5.0, Build Time: Aug 19 2021 11:20:18" | -+-----------+------+----------+---------+--------------+-------------------------------------------+ ++-----------+------+----------+---------+---------------+--------+ +| Host | Port | Status | Role | Git Info Sha | Version | ++-----------+------+----------+---------+--------------+---------+ +| "graphd" | 9669 | "ONLINE" | "GRAPH" | "3ba41bd" | "2.6.0" | +| "graphd1" | 9669 | "ONLINE" | "GRAPH" | "3ba41bd" | "2.6.0" | +| "graphd2" | 9669 | "ONLINE" | "GRAPH" | "3ba41bd" | "2.6.0" | ++-----------+------+----------+---------+--------------+---------+ nebula> SHOW HOSTS STORAGE; -+-------------+------+----------+-----------+--------------+-------------------------------------------+ -| Host | Port | Status | Role | Git Info Sha | Version | -+-------------+------+----------+-----------+--------------+-------------------------------------------+ -| "storaged0" | 9779 | "ONLINE" | "STORAGE" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -| "storaged1" | 9779 | "ONLINE" | "STORAGE" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -| "storaged2" | 9779 | "ONLINE" | "STORAGE" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -+-------------+------+----------+-----------+--------------+-------------------------------------------+ ++-------------+------+----------+-----------+--------------+---------+ +| Host | Port | Status | Role | Git Info Sha | Version | ++-------------+------+----------+-----------+--------------+---------+ +| "storaged0" | 9779 | "ONLINE" | "STORAGE" | "3ba41bd" | "2.6.0" | +| "storaged1" | 9779 | "ONLINE" | "STORAGE" | "3ba41bd" | "2.6.0" | +| "storaged2" | 9779 | "ONLINE" | "STORAGE" | "3ba41bd" | "2.6.0" | ++-------------+------+----------+-----------+--------------+---------+ nebula> SHOW HOSTS META; -+----------+------+----------+--------+--------------+-------------------------------------------+ -| Host | Port | Status | Role | Git Info Sha | Version | -+----------+------+----------+--------+--------------+-------------------------------------------+ -| "metad2" | 9559 | "ONLINE" | "META" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -| "metad0" | 9559 | "ONLINE" | "META" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -| "metad1" | 9559 | "ONLINE" | "META" | "5b83e5cb" | "2.5.0, Build Time: Aug 19 2021 10:30:28" | -+----------+------+----------+--------+--------------+-------------------------------------------+ ++----------+------+----------+--------+--------------+---------+ +| Host | Port | Status | Role | Git Info Sha | Version | ++----------+------+----------+--------+--------------+---------+ +| "metad2" | 9559 | "ONLINE" | "META" | "3ba41bd" | "2.6.0" | +| "metad0" | 9559 | "ONLINE" | "META" | "3ba41bd" | "2.6.0" | +| "metad1" | 9559 | "ONLINE" | "META" | "3ba41bd" | "2.6.0" | ++----------+------+----------+--------+--------------+---------+ ``` diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md index 597e68d6c54..d94189de379 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/7.show-index-status.md @@ -12,18 +12,19 @@ SHOW {TAG | EDGE} INDEX STATUS; ```ngql nebula> SHOW TAG INDEX STATUS; -+----------------+--------------+ -| Name | Index Status | -+----------------+--------------+ -| "like_index_0" | "FINISHED" | -| "like1" | "FINISHED" | -+----------------+--------------+ ++------------------------------------+--------------+ +| Name | Index Status | ++------------------------------------+--------------+ +| "date1_index" | "FINISHED" | +| "basketballplayer_all_tag_indexes" | "FINISHED" | +| "any_shape_geo_index" | "FINISHED" | ++------------------------------------+--------------+ nebula> SHOW EDGE INDEX STATUS; +----------------+--------------+ | Name | Index Status | +----------------+--------------+ -| "index_follow" | "FINISHED" | +| "follow_index" | "FINISHED" | +----------------+--------------+ ``` diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md index 18af3686752..0d241814653 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md @@ -46,16 +46,16 @@ nebula> GO FROM "player100" OVER follow BIDIRECT \ +---------------------+------------+ | Player | Name_Count | +---------------------+------------+ +| "Shaquille O'Neal" | 1 | | "Tiago Splitter" | 1 | -| "Aron Baynes" | 1 | -| "Boris Diaw" | 1 | | "Manu Ginobili" | 2 | -| "Dejounte Murray" | 1 | -| "Danny Green" | 1 | -| "Tony Parker" | 2 | -| "Shaquille O'Neal" | 1 | +| "Boris Diaw" | 1 | | "LaMarcus Aldridge" | 1 | +| "Tony Parker" | 2 | | "Marco Belinelli" | 1 | +| "Dejounte Murray" | 1 | +| "Danny Green" | 1 | +| "Aron Baynes" | 1 | +---------------------+------------+ ``` diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md index be1a3985f42..3fa07e84cdf 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md @@ -47,9 +47,9 @@ nebula> LOOKUP ON player |\ # The following example returns the 3 rows of data starting from the second row of the sorted output. nebula> GO FROM "player100" OVER follow REVERSELY \ - YIELD properties($$).name AS Friend, properties($$).age AS Age \| - ORDER BY $-.Age, $-.Friend \| - LIMIT 1, 3; + YIELD properties($$).name AS Friend, properties($$).age AS Age \ + | ORDER BY $-.Age, $-.Friend \ + | LIMIT 1, 3; +-------------------+-----+ | Friend | Age | +-------------------+-----+ @@ -91,6 +91,17 @@ nebula> GO 3 STEPS FROM "player100" \ | "Tony Parker" | 36 | | "Manu Ginobili" | 41 | +-----------------+--------------+ + +nebula> GO 3 STEPS FROM "player102" \ + OVER * \ + LIMIT [rand32(5),rand32(5),rand32(5)]; ++------------+-------------+---------------------+ +| serve._dst | follow._dst | any_shape_edge._dst | ++------------+-------------+---------------------+ +| "team204" | | | +| "team215" | | | +| | "player100" | | ++------------+-------------+---------------------+ ``` ## LIMIT in openCypher compatible statements diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md index 0944f35077b..ed80cda1925 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md @@ -93,22 +93,22 @@ nGQL lists NULL values at the end of the output for ascending sorting, and at th nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) \ RETURN v2.name AS Name, v2.age AS Age \ ORDER BY Age; -+-----------------+----------+ -| Name | Age | -+-----------------+----------+ -| "Tony Parker" | 36 | -| "Manu Ginobili" | 41 | -| "Spurs" | __NULL__ | -+-----------------+----------+ ++-----------------+--------------+ +| Name | Age | ++-----------------+--------------+ +| "Tony Parker" | 36 | +| "Manu Ginobili" | 41 | +| "Spurs" | UNKNOWN_PROP | ++-----------------+--------------+ nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) \ RETURN v2.name AS Name, v2.age AS Age \ ORDER BY Age DESC; -+-----------------+----------+ -| Name | Age | -+-----------------+----------+ -| "Spurs" | __NULL__ | -| "Manu Ginobili" | 41 | -| "Tony Parker" | 36 | -+-----------------+----------+ ++-----------------+--------------+ +| Name | Age | ++-----------------+--------------+ +| "Spurs" | UNKNOWN_PROP | +| "Manu Ginobili" | 41 | +| "Tony Parker" | 36 | ++-----------------+--------------+ ``` diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md index d2daa0fcbaf..04cfe4c6694 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/return.md @@ -157,13 +157,13 @@ If a property matched does not exist, `NULL` is returned. ```ngql nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) \ RETURN v2.name, type(e), v2.age; -+-----------------+----------+----------+ -| v2.name | type(e) | v2.age | -+-----------------+----------+----------+ -| "Tony Parker" | "follow" | 36 | -| "Manu Ginobili" | "follow" | 41 | -| "Spurs" | "serve" | __NULL__ | -+-----------------+----------+----------+ ++-----------------+----------+--------------+ +| v2.name | type(e) | v2.age | ++-----------------+----------+--------------+ +| "Tony Parker" | "follow" | 36 | +| "Manu Ginobili" | "follow" | 41 | +| "Spurs" | "serve" | UNKNOWN_PROP | ++-----------------+----------+--------------+ ``` ## Return expression results @@ -195,7 +195,7 @@ nebula> RETURN 3 > 1; | true | +-------+ -RETURN 1+1, rand32(1, 5); +nebula> RETURN 1+1, rand32(1, 5); +-------+-------------+ | (1+1) | rand32(1,5) | +-------+-------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md index d251cb41d31..8fb785a5d38 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md @@ -59,7 +59,7 @@ If a tag or an edge type is already created, to set a timeout on a property boun ```ngql # Create a tag. -nebula> CREATE TAG t1 (a timestamp); +nebula> CREATE TAG IF NOT EXISTS t1 (a timestamp); # Use ALTER to update the tag and set the TTL options. nebula> ALTER TAG t1 ttl_col = "a", ttl_duration = 5; @@ -74,7 +74,7 @@ Use TTL options in the `CREATE` statement to set a timeout when creating a tag o ```ngql # Create a tag and set the TTL options. -nebula> CREATE TAG t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a"; +nebula> CREATE TAG IF NOT EXISTS t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a"; # Insert a vertex with tag t2. The timeout timestamp is 1612778164774 (1612778164674 + 100). nebula> INSERT VERTEX t2(a, b, c) values "102":(1612778164674, 30, "Hello"); diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md index 325313ac4f7..fb0d7594e87 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/where.md @@ -149,10 +149,10 @@ In nGQL, if a group of edges has the same source vertex, destination vertex, and ```ngql # The following example creates test data. -nebula> CREATE SPACE test (vid_type=FIXED_STRING(30)); +nebula> CREATE SPACE IF NOT EXISTS test (vid_type=FIXED_STRING(30)); nebula> USE test; -nebula> CREATE EDGE e1(p1 int); -nebula> CREATE TAG person(p1 int); +nebula> CREATE EDGE IF NOT EXISTS e1(p1 int); +nebula> CREATE TAG IF NOT EXISTS person(p1 int); nebula> INSERT VERTEX person(p1) VALUES "1":(1); nebula> INSERT VERTEX person(p1) VALUES "2":(2); nebula> INSERT EDGE e1(p1) VALUES "1"->"2"@0:(10); @@ -306,7 +306,9 @@ nebula> MATCH (v:player) \ | "Joel Embiid" | 25 | +-------------------------+-------+ -nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD properties(vertex).name, properties(vertex).age; +nebula> LOOKUP ON player \ + WHERE player.age IN [25,28] \ + YIELD properties(vertex).name, properties(vertex).age; +-------------+-------------------------+------------------------+ | VertexID | properties(VERTEX).name | properties(VERTEX).age | +-------------+-------------------------+------------------------+ diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/with.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/with.md index 17b57bb7394..e87f8b53641 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/with.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/with.md @@ -28,22 +28,22 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})--() \ WITH nodes(p) AS n \ UNWIND n AS n1 \ RETURN DISTINCT n1; -+----------------------------------------------------------------------+ -| n1 | -+----------------------------------------------------------------------+ -| ("player100" :star{} :person{} :player{age: 42, name: "Tim Duncan"}) | -| ("player101" :player{age: 36, name: "Tony Parker"}) | -| ("team204" :team{name: "Spurs"}) | -| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | -| ("player125" :player{age: 41, name: "Manu Ginobili"}) | -| ("player104" :player{age: 32, name: "Marco Belinelli"}) | -| ("player144" :player{age: 47, name: "Shaquile O'Neal"}) | -| ("player105" :player{age: 31, name: "Danny Green"}) | -| ("player113" :player{age: 29, name: "Dejounte Murray"}) | -| ("player107" :player{age: 32, name: "Aron Baynes"}) | -| ("player109" :player{age: 34, name: "Tiago Splitter"}) | -| ("player108" :player{age: 36, name: "Boris Diaw"}) | -+----------------------------------------------------------------------+ ++-----------------------------------------------------------+ +| n1 | ++-----------------------------------------------------------+ +| ("player100" :player{age: 42, name: "Tim Duncan"}) | +| ("player101" :player{age: 36, name: "Tony Parker"}) | +| ("team204" :team{name: "Spurs"}) | +| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) | +| ("player125" :player{age: 41, name: "Manu Ginobili"}) | +| ("player104" :player{age: 32, name: "Marco Belinelli"}) | +| ("player144" :player{age: 47, name: "Shaquille O'Neal"}) | +| ("player105" :player{age: 31, name: "Danny Green"}) | +| ("player113" :player{age: 29, name: "Dejounte Murray"}) | +| ("player107" :player{age: 32, name: "Aron Baynes"}) | +| ("player109" :player{age: 34, name: "Tiago Splitter"}) | +| ("player108" :player{age: 36, name: "Boris Diaw"}) | ++-----------------------------------------------------------+ ``` ### Example 2 diff --git a/docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md b/docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md index afe351c6190..f7de564f3a8 100644 --- a/docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md +++ b/docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md @@ -16,17 +16,19 @@ CREATE SPACE [IF NOT EXISTS] ( [replica_factor = ,] vid_type = {FIXED_STRING() | INT[64]} ) + [ON ] [COMMENT = '']; ``` -| Parameter | Description | -| :--- | :--- | -| `IF NOT EXISTS` | Detects if the related graph space exists. If it does not exist, a new one will be created. The graph space existence detection here only compares the graph space name (excluding properties). | -| `` | Uniquely identifies a graph space in a Nebula Graph instance. The name of the graph space is case-sensitive and allows letters, numbers, or underlines. [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md) are not allowed. | -| `partition_num` | Specifies the number of partitions in each replica. The suggested number is five times the number of the hard disks in the cluster. For example, if you have 3 hard disks in the cluster, we recommend that you set 15 partitions. The default value is 100. | -| `replica_factor` | Specifies the number of replicas in the cluster. The suggested number is 3 in a production environment and 1 in a test environment. The replica number must be an **odd number** for the need of quorum-based voting. The default value is 1. | -| `vid_type` | A required parameter. Specifies the VID type in a graph space. Available values are `FIXED_STRING(N)` and `INT64`. `INT` equals to `INT64`. `FIXED_STRING()` specifies the VID as a string, while `INT64` specifies it as an integer. `N` represents the maximum length of the VIDs. If you set a VID that is longer than `N` characters, Nebula Graph throws an error. | -| `COMMENT` | The remarks of the graph space. The maximum length is 256 bytes. By default, there is no comments on a space. | +|Parameter|Description| +|:---|:---| +|`IF NOT EXISTS`|Detects if the related graph space exists. If it does not exist, a new one will be created. The graph space existence detection here only compares the graph space name (excluding properties).| +|``|Uniquely identifies a graph space in a Nebula Graph instance. The name of the graph space is case-sensitive and allows letters, numbers, or underlines. [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md) are not allowed.| +|`partition_num`|Specifies the number of partitions in each replica. The suggested number is five times the number of the hard disks in the cluster. For example, if you have 3 hard disks in the cluster, we recommend that you set 15 partitions. The default value is 100.| +|`replica_factor`|Specifies the number of replicas in the cluster. The suggested number is 3 in a production environment and 1 in a test environment. The replica number must be an **odd number** for the need of quorum-based voting. The default value is 1.| +|`vid_type`|A required parameter. Specifies the VID type in a graph space. Available values are `FIXED_STRING(N)` and `INT64`. `INT` equals to `INT64`. `FIXED_STRING()` specifies the VID as a string, while `INT64` specifies it as an integer. `N` represents the maximum length of the VIDs. If you set a VID that is longer than `N` characters, Nebula Graph throws an error.| +|`ON `|Specifies the Group to which a space belongs. For more information, see [Group&Zone](../../7.data-security/5.zone.md).| +|`COMMENT`|The remarks of the graph space. The maximum length is 256 bytes. By default, there is no comments on a space.| !!! caution @@ -54,25 +56,25 @@ CREATE SPACE [IF NOT EXISTS] ( CREATE SPACE AS ; ``` -| Parameter | Description | -| :--- | :--- | +| Parameter | Description | +| :--- | :--- | | `` | The name of the graph space that is newly created. The name of the graph space is case-sensitive and allows letters, numbers, or underlines. [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md) are not allowed. When a new graph space is created, the schema of the old graph space `` will be cloned, including its parameters (the number of partitions and replicas, etc.), Tag, Edge type, and native indexes. | -| `` | The name of the graph space that already exists. | +| `` | The name of the graph space that already exists. | ## Examples ```ngql # The following example creates a graph space with a specified VID type and the maximum length. Other fields still use the default values. -nebula> CREATE SPACE my_space_1 (vid_type=FIXED_STRING(30)); +nebula> CREATE SPACE IF NOT EXISTS my_space_1 (vid_type=FIXED_STRING(30)); # The following example creates a graph space with a specified partition number, replica number, and VID type. -nebula> CREATE SPACE my_space_2 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30)); +nebula> CREATE SPACE IF NOT EXISTS my_space_2 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30)); # The following example creates a graph space with a specified partition number, replica number, and VID type, and adds a comment on it. -nebula> CREATE SPACE my_space_3 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30)) comment="Test the graph space"; +nebula> CREATE SPACE IF NOT EXISTS my_space_3 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30)) comment="Test the graph space"; # Clone a graph space. -nebula> CREATE SPACE my_space_4 as my_space_3; +nebula> CREATE SPACE IF NOT EXISTS my_space_4 as my_space_3; nebula> SHOW CREATE SPACE my_space_4; +--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Space | Create Space | @@ -115,6 +117,7 @@ To balance the request loads, use the following command. ```ngql nebula> BALANCE LEADER; +nebula> SHOW HOSTS; +-------------+------+----------+--------------+--------------------------------+--------------------------------+ | Host | Port | Status | Leader count | Leader distribution | Partition distribution | +-------------+------+----------+--------------+--------------------------------+--------------------------------+ diff --git a/docs-2.0/3.ngql-guide/9.space-statements/2.use-space.md b/docs-2.0/3.ngql-guide/9.space-statements/2.use-space.md index 28c5e123970..43b0f99526c 100644 --- a/docs-2.0/3.ngql-guide/9.space-statements/2.use-space.md +++ b/docs-2.0/3.ngql-guide/9.space-statements/2.use-space.md @@ -15,17 +15,15 @@ USE ; ## Examples ```ngql +# The following example creates two sample spaces. +nebula> CREATE SPACE IF NOT EXISTS space1 (vid_type=FIXED_STRING(30)); +nebula> CREATE SPACE IF NOT EXISTS space2 (vid_type=FIXED_STRING(30)); + # The following example specifies space1 as the current working graph space. nebula> USE space1; -# The following example traverses in space1. -nebula> GO FROM 1 OVER edge1; - -# The following example specifies space2 as the current working graph space. +# The following example specifies space2 as the current working graph space. Hereafter, you cannot read any data from space1, because these vertices and edges being traversed have no relevance with space1. nebula> USE space2; - -# The following example traverses in space2. Hereafter, you cannot read any data from space1, because these vertices and edges being traversed have no relevance with space1. -nebula> GO FROM 2 OVER edge2; ``` !!! Caution diff --git a/docs-2.0/4.deployment-and-installation/1.resource-preparations.md b/docs-2.0/4.deployment-and-installation/1.resource-preparations.md index 42e2e5a74b6..91d18110994 100644 --- a/docs-2.0/4.deployment-and-installation/1.resource-preparations.md +++ b/docs-2.0/4.deployment-and-installation/1.resource-preparations.md @@ -107,49 +107,50 @@ This section guides you through the downloading and installation of software req 2. Check if the GCC and cmake on your host are in the right version. See [Software requirements for compiling Nebula Graph](#software_requirements_for_compiling_nebula_graph) for the required versions. - ```bash - $ g++ --version - $ cmake --version - ``` - If your GCC and CMake are in the right version, then you are all set. If they are not, follow the sub-steps as follows. + ```bash + $ g++ --version + $ cmake --version + ``` - 1. Clone the `nebula-common` repository to your host. + If your GCC and CMake are in the right version, then you are all set. If they are not, follow the sub-steps as follows. - ```bash - $ git clone -b {{common.release}} https://github.com/vesoft-inc/nebula-common.git - ``` - - Users can use the `--branch` or `-b` option to specify the branch to be cloned. For example, for {{ nebula.release }}, run the following command. + 1. Clone the `nebula` repository to your host. + + ```bash + $ git clone -b {{nebula.branch}} https://github.com/vesoft-inc/nebula-common.git + ``` - ```bash - $ git clone --branch v{{ nebula.release }} https://github.com/vesoft-inc/nebula-common.git - ``` + Users can use the `--branch` or `-b` option to specify the branch to be cloned. For example, for {{ nebula.release }}, run the following command. - 2. Make `nebula-common` the current working directory. + ```bash + $ git clone --branch {{nebula.branch }} https://github.com/vesoft-inc/nebula-common.git + ``` - ```bash - $ cd nebula-common - ``` + 1. Make `nebula` the current working directory. - 3. Run the following commands to install and enable CMake and GCC. + ```bash + $ cd nebula + ``` - ```bash - // Install CMake. - $ ./third-party/install-cmake.sh cmake-install - - // Enable CMake. - $ source cmake-install/bin/enable-cmake.sh - - // Authorize the write privilege to the opt directory. - $ sudo mkdir /opt/vesoft && sudo chmod -R a+w /opt/vesoft - - // Install GCC. Installing GCC to the opt directory requires the write privilege. And users can change it to other locations. - $ ./third-party/install-gcc.sh --prefix=/opt - - // Enable GCC. - $ source /opt/vesoft/toolset/gcc/7.5.0/enable - ``` + 1. Run the following commands to install and enable CMake and GCC. + + ```bash + // Install CMake. + $ ./third-party/install-cmake.sh cmake-install + + // Enable CMake. + $ source cmake-install/bin/enable-cmake.sh + + // Authorize the write privilege to the opt directory. + $ sudo mkdir /opt/vesoft && sudo chmod -R a+w /opt/vesoft + + // Install GCC. Installing GCC to the opt directory requires the write privilege. And users can change it to other locations. + $ ./third-party/install-gcc.sh --prefix=/opt + + // Enable GCC. + $ source /opt/vesoft/toolset/gcc/7.5.0/enable + ``` 3. Execute the script `install-third-party.sh`. diff --git a/docs-2.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code.md b/docs-2.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code.md index 2381ee3956e..ff831b4b944 100644 --- a/docs-2.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code.md +++ b/docs-2.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/1.install-nebula-graph-by-compiling-the-source-code.md @@ -10,31 +10,35 @@ Installing Nebula Graph from the source code allows you to customize the compili ## Installation steps +!!! Note + + Starting with the Nebula Graph {{ nebula.release }} release, the code repositories for Nebula-Graph, Nebula-Storage, and Nebula-Common have been merged into the Nebula code repository, so the compilation steps are different from those in previous releases. + 1. Use Git to clone the source code of Nebula Graph to the host. - - [Recommended] To install Nebula Graph v{{nebula.release}}, run the following command. + - [Recommended] To install Nebula Graph {{nebula.release}}, run the following command. - ```bash - $ git clone --branch v{{nebula.release}} https://github.com/vesoft-inc/nebula-graph.git - ``` + ```bash + $ git clone --branch {{nebula.branch}} https://github.com/vesoft-inc/nebula.git + ``` - - To install the latest developing release, run the following command to clone the source code from the master branch. + - To install the latest developing release, run the following command to clone the source code from the master branch. - ```bash - $ git clone https://github.com/vesoft-inc/nebula-graph.git - ``` + ```bash + $ git clone https://github.com/vesoft-inc/nebula.git + ``` -2. Make the `nebula-graph` directory the current working directory. +2. Make the `nebula` directory the current working directory. - ```bash - $ cd nebula-graph - ``` + ```bash + $ cd nebula + ``` 3. Create a `build` directory and make it the current working directory. - ```bash - $ mkdir build && cd build - ``` + ```bash + $ mkdir build && cd build + ``` 4. Generate Makefile with CMake. @@ -44,18 +48,9 @@ Installing Nebula Graph from the source code allows you to customize the compili For more information about CMake variables, see [CMake variables](#cmake_variables). - - If the source code of Nebula Graph v{{nebula.release}} is installed and cloned in step 1, run the following command. The `-DNEBULA_COMMON_REPO_TAG` and `-DNEBULA_STORAGE_REPO_TAG` options are used to specify the correct branches of [nebula-common](https://github.com/vesoft-inc/nebula-common) and [nebula-storage](https://github.com/ vesoft-inc/nebula-storage) repositories to keep the releases of the Nebula Graph components consistent. - - ```bash - $ cmake -DENABLE_BUILD_STORAGE=on -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \ - -DNEBULA_COMMON_REPO_TAG=v{{ nebula.release }} -DNEBULA_STORAGE_REPO_TAG=v{{ nebula.release }} .. - ``` - - - If the source code of the `master` branch is installed in step 1, run the following command. - - ```bash - $ cmake -DENABLE_BUILD_STORAGE=on -DENABLE_TESTING=OFF -DENABLE_MODULE_UPDATE=ON -DCMAKE_BUILD_TYPE=Release .. - ``` + ```bash + $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release .. + ``` 5. Compile Nebula Graph. @@ -65,15 +60,15 @@ Installing Nebula Graph from the source code allows you to customize the compili To speed up the compiling, use the `-j` option to set a concurrent number `N`. It should be $\min(\text{CPU}core number,\frac{the_memory_size(GB)}{2})$. - ```bash - $ make -j{N} # E.g., make -j2 - ``` + ```bash + $ make -j{N} # E.g., make -j2 + ``` 6. Install Nebula Graph. - ```bash - $ sudo make install-all - ``` + ```bash + $ sudo make install + ``` 7. The configuration files in the `etc/` directory (`/usr/local/nebula/etc` by default) are references. Users can create their own configuration files accordingly. If you want to use the scripts in the `script` directory to start, stop, restart, and kill the service, and check the service status, the configuration files have to be named as `nebula-graph.conf`, `nebula-metad.conf`, and `nebula-storaged.conf`. @@ -81,20 +76,16 @@ Installing Nebula Graph from the source code allows you to customize the compili The source code of the master branch changes frequently. If the corresponding Nebula Graph release is installed, update it in the following steps. - 1. In the `nebula-graph/` directory, run `git pull upstream master` to update the source code. +1. In the `nebula` directory, run `git pull upstream master` to update the source code. - 2. In the `nebula-graph/modules/common/` and `nebula-graph/modules/storage/` directories, run `git pull upstream master` separately. +2. In the `nebula/build` directory, run `make -j{N}` and `make install` again. - 3. In the `nebula-graph/build/` directory, run `make -j{N}` and `make install-all` again. +## Next to do -## Next +- (Enterprise Edition)[Deploy license](../deploy-license.md) - [Manage Nebula Graph services](../../2.quick-start/5.start-stop-service.md) -- [Connect to Nebula Graph](../../2.quick-start/3.connect-to-nebula-graph.md) - -- [Nebula Graph CRUD](../../2.quick-start/4.nebula-graph-crud.md) - ## CMake variables ### Usage of CMake variables @@ -105,12 +96,6 @@ $ cmake -D= ... The following CMake variables can be used at the configure (cmake) stage to adjust the compiling settings. -### ENABLE_BUILD_STORAGE - -Starting from {{ nebula.release }}, Nebula Graph uses two separated github repositories of graph and storage for separated compiling. The `ENABLE_BUILD_STORAGE` variable is set to `OFF` by default so that the storage service is not installed together with the graph service. - -If you are deploying Nebula Graph on a single host for testing, you can set `ENABLE_BUILD_STORAGE` to `ON` to download and install the storage service automatically. - ### CMAKE_INSTALL_PREFIX `CMAKE_INSTALL_PREFIX` specifies the path where the service modules, scripts, configuration files are installed. The default path is `/usr/local/nebula`. @@ -158,7 +143,7 @@ $ cmake -DCMAKE_C_COMPILER= -DCMAKE_CXX_COMPILER= !!! note + - Make sure all the processes of services on each machine are started. Otherwise, you will fail to start Nebula Graph. + - When the graphd process, the storaged process, and the metad process are all started, you can use `all` instead. - `/usr/local/nebula` is the default installation path for Nebula Graph. Use the actual path if you have customized the path. For more information about how to start and stop the services, see [Manage Nebula Graph services](../manage-service.md). diff --git a/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-260.md b/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-latest.md similarity index 98% rename from docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-260.md rename to docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-latest.md index 25d03ebd442..21222ae4222 100644 --- a/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-260.md +++ b/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-from-200-to-latest.md @@ -4,7 +4,7 @@ To upgrade Nebula Graph v2.0.x to v{{nebula.release}}, you only need to use the !!! note - Nebula Graph v2.0.x refers to v2.0.0-GA and v2.0.1 releases. If your Nebula Graph version is too low (v2.0.0-RC, v2.0.0-beta, v1.x), see [Upgrade Nebula Graph to v{{nebula.release}}](upgrade-nebula-graph-to-260.md). + Nebula Graph v2.0.x refers to v2.0.0-GA and v2.0.1 releases. If your Nebula Graph version is too low (v2.0.0-RC, v2.0.0-beta, v1.x), see [Upgrade Nebula Graph to v{{nebula.release}}](upgrade-nebula-graph-to-latest.md). ## Upgrade steps with RPM/DEB packages @@ -46,7 +46,7 @@ To upgrade Nebula Graph v2.0.x to v{{nebula.release}}, you only need to use the ## Upgrade steps by deploying Docker Compose -1. Modify the file `docker-compose.yaml` in the directory `nebula-docker-compose`, and modify all versions after `image` to `{{nebula.release}}`. +1. Modify the file `docker-compose.yaml` in the directory `nebula-docker-compose`, and modify all versions after `image` to `{{nebula.branch}}`. 2. Execute the command `docker-compose pull` in the directory `nebula-docker-compose` to update the images of all services. diff --git a/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-260.md b/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-latest.md similarity index 97% rename from docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-260.md rename to docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-latest.md index e1cf4bf98ee..d1434f01a17 100644 --- a/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-260.md +++ b/docs-2.0/4.deployment-and-installation/3.upgrade-nebula-graph/upgrade-nebula-graph-to-latest.md @@ -4,7 +4,7 @@ The legacy versions of Nebula Graph refer to the versions lower than Nebula Grap !!! note - To upgrade Nebula Graph v2.0.0-GA or later versions to v{{nebula.release}}, see [Nebula Graph v2.0.x to v{{nebula.release}}](upgrade-nebula-from-200-to-260.md). + To upgrade Nebula Graph v2.0.0-GA or later versions to v{{nebula.release}}, see [Nebula Graph v2.0.x to v{{nebula.release}}](upgrade-nebula-from-200-to-latest.md). ## Limitations @@ -96,13 +96,13 @@ By default, old versions of Nebula Graph are installed in `/usr/local/nebula/`, - Clone the source code. ``` - # git clone --branch v{{nebula.release}} https://github.com/vesoft-inc/nebula-graph.git + # git clone --branch {{nebula.branch}} https://github.com/vesoft-inc/nebula-graph.git ``` - Configure CMake. ``` - # cmake -DCMAKE_INSTALL_PREFIX=${nebula-new} -DENABLE_BUILD_STORAGE=on -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DNEBULA_COMMON_REPO_TAG=v{{nebula.release}} -DNEBULA_STORAGE_REPO_TAG=v{{nebula.release}} .. + # cmake -DCMAKE_INSTALL_PREFIX=${nebula-new} -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release .. ``` 2. Copy the configuration files from the old path to the new path. diff --git a/docs-2.0/4.deployment-and-installation/6.deploy-text-based-index/2.deploy-es.md b/docs-2.0/4.deployment-and-installation/6.deploy-text-based-index/2.deploy-es.md index dc0e1a41af4..5b6225c3dd3 100644 --- a/docs-2.0/4.deployment-and-installation/6.deploy-text-based-index/2.deploy-es.md +++ b/docs-2.0/4.deployment-and-installation/6.deploy-text-based-index/2.deploy-es.md @@ -8,7 +8,7 @@ Before you start using the full-text index, please make sure that you know the [ ## Deploy Elasticsearch cluster -To deploy an Elasticsearch cluster, see [Kubernetes Elasticsearch deployment](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-elasticsearch.html) or [Elasticsearch installation](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/_installation.html). +To deploy an Elasticsearch cluster, see [Kubernetes Elasticsearch deployment](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-elasticsearch.html) or [Elasticsearch installation](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/targz.html). When the Elasticsearch cluster is started, add the template file for the Nebula Graph full-text index. For more information on index templates, see [Elasticsearch Document](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html). @@ -77,7 +77,7 @@ When the Elasticsearch cluster is deployed, use the `SIGN IN` statement to sign ### Syntax ```ngql -SIGN IN TEXT SERVICE [( [,, ]), (), ...]; +SIGN IN TEXT SERVICE [( [,"", ""]), (), ...]; ``` ### Example diff --git a/docs-2.0/4.deployment-and-installation/deploy-license.md b/docs-2.0/4.deployment-and-installation/deploy-license.md new file mode 100644 index 00000000000..62576a8400b --- /dev/null +++ b/docs-2.0/4.deployment-and-installation/deploy-license.md @@ -0,0 +1,71 @@ +# Deploy license + +Nebula Graph Enterprise Edition requires the user to deploy a license file before starting the Enterprise Edition. This topic describes how to deploy a license file for the Enterprise Edition. + +!!! enterpriseonly + + License is a software authorization certificate provided for users of the Enterprise Edition. Users of the Enterprise Edition can send email to `inquiry@vesoft.com` to apply for a license file. + +## Precautions + +- If the license file is not deployed, Nebula Graph Enterprise Edition cannot be started. + +- Do not modify the license file, otherwise the license will become invalid. + +- If the license is about to expire, send email to `inquiry@vesoft.com` to apply for renewal. + +- The transition period after the license expires is 3 days: + + - If you start the Enterprise Edition within 7 days before the license expires or on the day the license expires, a log will be printed as a reminder. + + - The license can still be used for 3 days after it expires. + + - If the license has expired for 3 days, you will not be able to start the Enterprise Edition, and a log will be printed as a reminder. + +## License description + +You can use `cat` to view the content of the license file (`nebula.license`). The example is as follows: + +```bash +----------License Content Start---------- +{ + "vendor": "Vesoft_Inc", + "organization": "doc", + "issuedDate": "2021-11-07T16:00:00.000Z", + "expirationDate": "2021-11-30T15:59:59.000Z", + "product": "nebula_graph", + "version": ">2.6.1", + "licenseType": "enterprise" +} +----------License Content End---------- + +----------License Key Start---------- +cofFcOxxxxxxxxxxxxxhnZgaxrQ== +----------License Key End---------- +``` + +The license file contains information such as `issuedDate` and `expirationDate`. The description is as follows. + +|Parameter|Description| +|:---|:---| +|`vendor`|The supplier.| +|`organization`|The username.| +|`issuedDate`|The date that the license is issued. | +|`expirationDate`|The date that the license expires.| +|`product`|The product type. The product type of Nebula Graph is `nebula_graph`.| +|`version`|The version information.| +|`licenseType`|The license type, including `enterprise`, `samll_bussiness`, `pro`, and `individual`. | + +## Steps + +1. Send email to `inquiry@vesoft.com` to apply for the Nebula Graph Enterprise Edition package. + +2. Install Nebula Graph Enterprise Edition. The installation method is the same as the Community Edition. See [Install Nebula Graph with RPM or DEB package](2.compile-and-install-nebula-graph/2.install-nebula-graph-by-rpm-or-deb.md). + +3. Send email to `inquiry@vesoft.com` to apply for the license file `nebula.license`. + +4. Upload the license file to all hosts that contain Meta services. The path is in the `share/resources/` of each Meta service installation directory. + + !!! note + + For the upload address of the license file for ecosystem tools, refer to the document of [Ecosystem tools overview](../20.appendix/6.eco-tool-version.md). diff --git a/docs-2.0/7.data-security/1.authentication/3.role-list.md b/docs-2.0/7.data-security/1.authentication/3.role-list.md index 14dcf34c3e0..2cf6c405d6a 100644 --- a/docs-2.0/7.data-security/1.authentication/3.role-list.md +++ b/docs-2.0/7.data-security/1.authentication/3.role-list.md @@ -59,7 +59,7 @@ The privileges of roles and the nGQL statements that each role can use are liste |Read space|Y|Y|Y|Y|Y|`USE`, `DESCRIBE SPACE`| |Write space|Y|||||`CREATE SPACE`, `DROP SPACE`, `CREATE SNAPSHOT`, `DROP SNAPSHOT`, `BALANCE DATA`, `BALANCE DATA STOP`, `BALANCE DATA REMOVE`, `BALANCE LEADER`, `ADMIN`, `CONFIG`, `INGEST`, `DOWNLOAD`, `BUILD TAG INDEX`, `BUILD EDGE INDEX`| |Read schema|Y|Y|Y|Y|Y|`DESCRIBE TAG`, `DESCRIBE EDGE`, `DESCRIBE TAG INDEX`, `DESCRIBE EDGE INDEX`| - |Write schema|Y|Y|Y|||`CREATE TAG`, `ALTER TAG`, `CREATE EDGE`, `ALTER EDGE`, `DROP TAG`, `DROP EDGE`, `CREATE TAG INDEX`, `CREATE EDGE INDEX`, `DROP TAG INDEX`, `DROP EDGE INDEX`| + |Write schema|Y|Y|Y|||`CREATE TAG`, `ALTER TAG`, `CREATE EDGE`, `ALTER EDGE`, `DROP TAG`, `DELETE TAG`, `DROP EDGE`, `CREATE TAG INDEX`, `CREATE EDGE INDEX`, `DROP TAG INDEX`, `DROP EDGE INDEX`| |Write user|Y|||||`CREATE USER`, `DROP USER`, `ALTER USER`| |Write role|Y|Y||||`GRANT`, `REVOKE`| |Read data|Y|Y|Y|Y|Y|`GO`, `SET`, `PIPE`, `MATCH`, `ASSIGNMENT`, `LOOKUP`, `YIELD`, `ORDER BY`, `FETCH VERTICES`, `Find`, `FETCH EDGES`, `FIND PATH`, `LIMIT`, `GROUP BY`, `RETURN`| diff --git a/docs-2.0/7.data-security/3.manage-snapshot.md b/docs-2.0/7.data-security/3.manage-snapshot.md index 6e892143dd2..dfa40ffd593 100644 --- a/docs-2.0/7.data-security/3.manage-snapshot.md +++ b/docs-2.0/7.data-security/3.manage-snapshot.md @@ -90,7 +90,7 @@ nebula> SHOW SNAPSHOTS; Currently, there is no command to restore data with snapshots. You need to manually copy the snapshot file to the corresponding folder, or you can make it by using a shell script. The logic implements as follows: -1. After the snapshot is created, the `checkpoints` directory is generated in the installation directory of the Meta server and Storage server, and saves the created snapshot. Taking this topic as an example, when there are two graph spaces, the snapshots created are saved in `/usr/local/nebula/data/meta/nebula/0/checkpoints`, `/usr/local/nebula/data/storage/ nebula/3/checkpoints` and `/usr/local/nebula/data/storage/nebula/4/checkpoints`. +1. After the snapshot is created, the `checkpoints` directory is generated in the installation directory of the leader Meta server and all Storage servers, and saves the created snapshot. Taking this topic as an example, when there are two graph spaces, the snapshots created are saved in `/usr/local/nebula/data/meta/nebula/0/checkpoints`, `/usr/local/nebula/data/storage/ nebula/3/checkpoints` and `/usr/local/nebula/data/storage/nebula/4/checkpoints`. ```bash $ ls /usr/local/nebula/data/meta/nebula/0/checkpoints/ @@ -101,7 +101,11 @@ Currently, there is no command to restore data with snapshots. You need to manua SNAPSHOT_2021_03_09_09_10_52 ``` -2. To restore the lost data through snapshots, users can take a snapshot at an appropriate time, copy the internal folders `data` and `wal` to their respective parent directories (at the same level with `checkpoints`), overwrite the previous `data` and `wal`, and then restart the cluster. +2. To restore the lost data through snapshots, you can take a snapshot at an appropriate time, copy the folders `data` and `wal` in the corresponding snapshot directory to its parent directory (at the same level with `checkpoints`) to overwrite the previous `data` and `wal`, and then restart the cluster. + + !!! caution + + The data and wal directories of all Meta servers should be overwritten at the same time. Otherwise, the new leader Meta server will use the latest Meta data after a cluster is restarted. diff --git a/docs-2.0/nebula-algorithm.md b/docs-2.0/nebula-algorithm.md index 3f89bc6ad15..42b8dbc2e99 100644 --- a/docs-2.0/nebula-algorithm.md +++ b/docs-2.0/nebula-algorithm.md @@ -16,9 +16,11 @@ Before using the Nebula Algorithm, users need to confirm the following informati ## Limitations -The data of the vertex ID must be an integer. That is, the vertex ID can be INT or String, but the data itself is an integer. +- The data of the vertex ID must be an integer. That is, the vertex ID can be INT or String, but the data itself is an integer. -For non-integer String data, it is recommended to use the algorithm interface. You can use the `dense_rank` function of SparkSQL to encode the data as the Long type instead of the String type. +- For non-integer String data, it is recommended to use the algorithm interface. You can use the `dense_rank` function of SparkSQL to encode the data as the Long type instead of the String type. + +- Graph computing outputs vertex datasets, and the algorithm results are stored in DataFrames as the properties of vertices. You can do further operations such as statistics and filtering according to your business requirements. ## Supported algorithms diff --git a/docs-2.0/nebula-bench.md b/docs-2.0/nebula-bench.md index 92b51305bae..32564ece43f 100644 --- a/docs-2.0/nebula-bench.md +++ b/docs-2.0/nebula-bench.md @@ -8,6 +8,10 @@ Nebula Bench is a performance test tool for Nebula Graph using the LDBC data set - Performance testing in the Nebula Graph cluster. +## Release note + +[Release](https://github.com/vesoft-inc/nebula-bench/releases/tag/{{bench.tag}}) + ## Test process 1. Generate test data by using ldbc_snb_datagen. diff --git a/docs-2.0/nebula-dashboard-ent/1.what-is-dashboard-ent.md b/docs-2.0/nebula-dashboard-ent/1.what-is-dashboard-ent.md new file mode 100644 index 00000000000..80d45f8a4f0 --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/1.what-is-dashboard-ent.md @@ -0,0 +1,47 @@ +# What is Nebula Dashboard Enterprise Edition + +Nebula Dashboard Enterprise Edition (Dashboard for short) is a visualization tool that monitors and manages the status of machines and services in Nebula Graph clusters. This topic introduces Dashboard Enterprise Edition. For more information, see [What is Nebula Dashboard Community Edition](../nebula-dashboard/1.what-is-dashboard.md). + +## Features + +- Create a Nebula Graph cluster of a specified version, import nodes in batches, scale out Nebula Graph services with one click + +- Import clusters, balance data, scale out or in on the visualization interface. + +- Manage clusters, and view the operation log of clusters within the last 14 days. + +- Start, stop, and restart services on the visualization interface. + +- Update the configuration of Storage services and Graph services in clusters quickly. + +- Monitor the information of all the services in clusters, including the IP address, version, and monitoring metrics (such as the number of queries, the latency of queries, and the latency of heartbeats). + +- Monitor the status of all the machines in clusters, including CPU, memory, load, disk, and network. + +- Monitor the information of clusters, including the information of services, partitions, configurations, and long-term tasks. + +## Scenarios + +- You want a visualized operation and maintenance monitoring platform for large-scale clusters. + +- You want to monitor key metrics conveniently and quickly, and present multiple key information of the business to ensure that the business can be operated normally. + +- You want to monitor clusters from multiple dimensions (such as the time, aggregate rules, and metrics). + +- You want to review the failure after it occurs, confirm when it happened, and view its associated phenomena. + +## Precautions + +- The monitoring data will be updated per 7 seconds by default. + +- The monitoring data will be retained for 14 days by default, that is, only the monitoring data within the last 14 days can be queried. + +- The version of Nebula Graph must be 2.0.1 or later. + +- It is recommend to use the latest version of Chrome to access Dashboard. + +- It is recommend to use the official installation package to create or import clusters. + +!!! note + + The monitoring feature is supported by Prometheus. The update frequency and retention intervals can be modified. For details, see [Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/configuration/). diff --git a/docs-2.0/nebula-dashboard-ent/2.deploy-connect-dashboard-ent.md b/docs-2.0/nebula-dashboard-ent/2.deploy-connect-dashboard-ent.md new file mode 100644 index 00000000000..4f77aae27d2 --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/2.deploy-connect-dashboard-ent.md @@ -0,0 +1,148 @@ +# Deploy Dashboard + +This topic will introduce how to install and deploy Dashboard in detail. + +## Prerequisites + +Before deploying Dashboard, you must do a check of these: + +- Select and download Dashboard of the correct version. The version correspondence between Dashboard and Nebula Graph is as follows. + + | Dashboard version | Nebula Graph version | + | :-------------------------- | :--------------- | + | {{ dashboard_ent.release }} | 2.x | + +- The environment of [MySQL](https://www.mysql.com/) is ready and a database named as `dashboard` is created. +- Before the installation starts, the following ports are not occupied. + + | Port | Description | + | ---- | ---- | + | 7005 | The port through which Dashboard provides the web service. | + | 8090 | The port of the nebula-http-gateway service. | + | 9090 | The port of the prometheus service. | + | 9200 | The port of the nebula-stats-exporter service. | + +- The license is ready. + + !!! enterpriseonly + + The license is only available in the Enterprise Edition. To obtain the license, send email to inquiry@vesoft.com. + +## Install and start + +1. Select and download the tar package according to your needs. It is recommended to select the latest version. + + !!! enterpriseonly + + For features of Dashboard Enterprise Edition, see [Pricing](https://nebula-graph.com.cn/pricing/). + +2. Use `tar -xzvf` to decompress the tar package. + + ```bash + $ tar -xzvf nebula-dashboard-ent-.linux-amd64.tar.gz + ``` + + For example: + + ```bash + $ tar -xzvf nebula-dashboard-ent-1.0.0.linux-amd64.tar.gz + ``` + +3. Edit `vim config/config.yaml` to modify the configuration. + + ```bash + # Information about the database + database: + dialect: mysql # The type of database used, which currently only supports MySql + host: 192.168.8.157 # The IP address of the connected MySql database + port: 3306 # The port of the connected MySql database + username: root # The username to log in MySql + password: nebula # The password to log in MySql + name: dashboard # The name of the corresponding database + autoMigrate: true # Auto database tables creation, the default value of which is true + # Information about the exporter port + exporter: + nodePort: 9100 # The port of the node-exporter service + nebulaPort: 9200 # The port of the nebula-stats-exporter service + # Information of services + proxy: + gateway: + target: "127.0.0.1:8090" # The IP address and port of the gateway service + prometheus: + target: "127.0.0.1:9090" # The IP address and port of the prometheus service + ``` + +4. Copy the license file to the `nebula-dashboard-ent` directory. + + ```bash + $ cp -r + ``` + + For example: + + ```bash + $ cp -r nebula.license /usr/local/nebula-dashboard-ent + ``` + +5. Start Dashboard. + + You can use the following command to start the Dashboard with one click. + + ```bash + $ cd scripts + $ sudo ./dashboard.service start all + ``` + + Or execute the following commands to start prometheus, webserver, exporter and gateway services to start Dashboard. + + ```bash + $ cd scripts + $ sudo ./dashboard.service start prometheus # Start prometheus service + $ sudo ./dashboard.service start webserver # Start webserver service + $ sudo ./dashboard.service start exporter # Start exporter service + $ sudo ./dashboard.service start gateway # Start gateway service + ``` + +## Manage Dashboard Service + +You can use the `dashboard.service` script to start, stop, and check the Dashboard services. + +### Syntax + +```bash +$ sudo /dashboard/scripts/dashboard.service +[-v] [-h] + +``` + +| Parameter | Description | +| :------------------------- | :------------------- | +| `dashboard_path` | Dashboard installation path. | +| `-v` | Display detailed debugging information. | +| `-h` | Display help information. | +| `start` | Start the target services. | +| `stop` | Stop the target services. | +| `status` | Check the status of the target services. | +| `prometheus` | Set the prometheus Service as the target service. | +| `webserver` | Set the webserver Service as the target service. | +| `exporter` | Set the exporter Service as the target service. | +| `gateway` | Set the gateway Service as the target service. | +| `all` | Set all the Dashboard services as the target services. | + +### Examples + +Dashboard is installed in the current directory, and you can use the following commands to manage services. + +```bash +$ sudo /dashboard/scripts/dashboard.service start all #start all Dashboard service +$ sudo /dashboard/scripts/dashboard.service stop all #stop all Dashboard service +$ sudo /dashboard/scripts/dashboard.service status all #check all Dashboard service +``` + +## Next to do + +After Dashboard is successfully started, you can enter `http://:7005` in the address bar of a browser. + +If the following login interface is shown in the browser, then you have successfully deployed and started Dashboard. You can log into Dashboard as a GOD user with the default username `nebula` and password `nebula`. You can modify the password in [System Settings](../nebula-dashboard-ent/6.system-settings.md). And you also can use the GOD account to create a new account with the permission ADMIN on the [Account Management](../nebula-dashboard-ent/5.account-management.md) to log into the Dashboard. + +![start-page](../nebula-dashboard-ent/figs/ds-028.png) diff --git a/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/1.create-cluster.md b/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/1.create-cluster.md new file mode 100644 index 00000000000..49d94e7d524 --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/1.create-cluster.md @@ -0,0 +1,42 @@ +# Create clusters + +This topic introduces how to create clusters using Dashboard. + +## Steps + +You can create a cluster following these steps: + +1. In the **Cluster management** page, click **Create cluster**. +2. In the **Create cluster** page, fill in the following: + - Enter the **Cluster name**, 15 characters at most. In this example, the cluster name is `test_foesa`. + - Choose the Nebula Graph version to install. In this example, the version is `v2.6.1`. + - **Add nodes**. The information of each node is required. + + 1. Enter the IP information of each host. In this example, it is `192.168.8.144`. + 2. Enter the SSH information. In this example, the SSH port is `22`, the SSH user is `vesoft`, and the SSH password is `nebula`. + 3. Choose the Nebula Graph package. In this example, the package is `nebula-graph-2.6.1.el7.x86_64rpm`. + 4. (Optional) Enter the node name to make a note on the node. In this example, the note is `Node_1`. + + ![cluster](../figs/ds-021.png) + + - **Import nodes in batches**. The information of each node is required. To import nodes in batches, you need to choose the installation package and click **download the CSV template**. Fill in the template and upload it. Ensure that the node is correct, otherwise upload failure may happen. + + ![batch-import](../figs/ds-030.png) + +3. Select the node and add the service you need in the upper right corner. To create a cluster, you need to add 3 types of services to the node. If not familiar with the Nebula Graph architecture, click **Auto add service**. + + ![add-service](../figs/ds-029.png) + +4. (Optional) Edit the port of the meta service, the graph service, the storage service, HTTP, and HTTP2, and click **OK** to save. + +5. Click **Create cluster**. Make sure the configuration is correct and there is no conflict between nodes, click **Confirm**. + + ![check](../figs/ds-023.png) + +6. If a cluster with the status of `installing` appears in the list on the cluster management page, you need to wait for 3 to 10 minutes until the status changes to `healthy`, that is, the cluster is created successfully. If the service status is `unhealthy`, it means that there is an abnormal service in the cluster, click **Detail** for more information. + + ![installing](../figs/ds-024.png) + +## Next to do + +After the cluster is successfully created, you can operate the cluster. For details, see [Overview](../4.cluster-operator/1.overview.md). diff --git a/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/2.import-cluster.md b/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/2.import-cluster.md new file mode 100644 index 00000000000..a04cb3f0fda --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/3.create-import-dashboard/2.import-cluster.md @@ -0,0 +1,37 @@ +# Import clusters + +This topic introduces how to import clusters using Dashboard. The current version only supports importing clusters deployed by the official DEB or RPM packages and clusters created by Dashboard. Currently, importing clusters deployed by Docker and Kubernetes is not supported. + +## Steps + +!!! caution + + - In the same cluster, the service versions need to be unified. Importing Nebula Graph examples from different versions in the same cluster is not supported. + - The installation path of Nebula Graph needs to be the default installation path `/usr/local`. + +1. In the **Cluster management** page, click **Import cluster**. +2. In the **Import cluster** page, enter the information of **Connect to Nebula Graph**. + - Graphd Host: :n. In this example, the IP is `192.168.8.157:9669`. + - Username: The account to connect to Nebula Graph. In this example, the username is `vesoft`. + - Password: The password to connect to Nebula Graph. In this example, the password is `nebula`. + + !!! note + + By default, authentication is disabled in Nebula Graph. Therefore, you can use `root` as the username and any password to connect to Nebula Graph. + When authentication is enabled in Nebula Graph, you need to use the specified username and password to connect to Nebula Graph. For details of authentication,see [Nebula Graph manual](../../7.data-security/1.authentication/1.authentication.md "Click to go to Nebula Graph website"). + + ![connect](../figs/ds-025.png) + +3. In the **Connect to Nebula Graph** page, fill in the following: + - Enter the cluster name, 15 characters at most. In this example, the cluster name is `create_1027`. + - **Authorize** the node. The SSH username and password of each node are required. + - **Batch authorization** requires uploading the CSV file. Edit the authentication information of each node according to the downloaded CSV file. Ensure that the node information is correct, otherwise upload failure may happen. + ![Batch authentication](../figs/ds-026.png) + - If the node status on the page becomes **authorized**, the node authentication is successful. + ![Authorize](../figs/ds-027.png) + +4. Ensure that all nodes are authorized successfully. Click **Import cluster**. + +## Next to do + +After the cluster is successfully imported, you can operate the cluster. For details, see [Overview](../4.cluster-operator/1.overview.md). \ No newline at end of file diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/1.overview.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/1.overview.md new file mode 100644 index 00000000000..7db334f101d --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/1.overview.md @@ -0,0 +1,49 @@ +# Cluster overview + +This topic introduces the **Overview** page of Dashboard. You can click **Detail** on the right of the cluster management page to check the overview of a specified cluster. + +## Overview + +![overview](../figs/ds-001.png) + +The **Overview** page has five parts: + +- Cluster survey +- Information +- Node +- Status list +- Service + +### Cluster survey + +In this part, you can view the number of nodes as well as the number of running and abnormal services of Graphd, Storaged, and Metad. In this example, there is **1** abnormal service in the Graphd service. You can click the **View** button to quickly check the abnormal service. + +### Information + +In this part, you can view the information of **Cluster name**, **Creation time**, **Creator**, and **Version**. + +!!! note + + The version here is the Nebula Graph version installed by the user, not the Dashboard version. + +!!! caution + + If the version of Nebula Graph imported by the user is before v2.5.0 or the version is unknown, v2.0.1 will be shown by default. + +### Node + +- You can view the information of node monitoring quickly and change the displayed information. By default, the CPU information will be shown. +- You can click ![setup](../figs/Setup.png) on the page to insert a base line. +- You can click ![watch](../figs/watch.png) to jump to the detailed node monitoring page. + +### Status list + +This part uses pie charts to visually display the running status of nodes. + +### Service + +- By default, the information of `query_latency_us` and `slow_query_latency_us` will be shown. + +- You can click ![setup](../figs/Setup.png) **Set up** to insert a base line. + +- You can click ![watch](../figs/watch.png) **View** to jump to the detailed service monitoring page. \ No newline at end of file diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/2.monitor.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/2.monitor.md new file mode 100644 index 00000000000..ca565b15d0d --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/2.monitor.md @@ -0,0 +1,33 @@ +# Cluster monitoring + +This topic introduces node monitoring and service monitoring of Dashboard. + +## Node + +![vertex](../figs/ds-002.png) + +On this page, you can view the variation of CPU, Memory, Load, Disk, and Network In/Out quickly. + +- To set a base line, click the ![setup](../figs/Setup.png) button. +- To view the detailed monitoring information, click the ![watch](../figs/watch.png) button. In this example, select `Load` for details. The figure is as follows. + ![load](../figs/ds-003.png) + - By default, you can view the monitoring data of the latest 1 hour, 6 hours, 12 hours, 1 day, 3 days, 7days, or 14 days. + - You can select the machine and monitoring metrics that you want to view. For details of monitoring metrics, see [Monitor parameter](../7.monitor-parameter.md). + - You can set a base line as a reference standard. + +## Service + +![service](../figs/ds-004.png) + +On this page, you can view the information of Graph, Meta, and Storage services quickly. In the upper right corner, the number of normal services and abnormal services will be displayed. + +!!! note + + In the current **Service** page of the Enterprise Edition, only two monitoring metrics can be set for each service, which can be adjusted by clicking the **Set up** button. + +- To view the detailed monitoring information, click the ![watch](../figs/watch.png) button. In this example, select `Graph` for details. The figure is as follows. + ![service](../figs/ds-005.png) + - By default, you can view the monitoring data of the latest 1 hour, 6 hours, 12 hours, 1 day, 3 days, 7days, or 14 days. + - You can select the machine and monitoring metrics that you want to view. For details of monitoring metrics, see [Monitor parameter](../7.monitor-parameter.md). + - You can set a base line as a reference standard. + - You can view the status of the current service. diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/3.cluster-information.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/3.cluster-information.md new file mode 100644 index 00000000000..00c1d284518 --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/3.cluster-information.md @@ -0,0 +1,81 @@ +# Cluster information + +This topic introduces the cluster information of Dashboard. The cluster information has the following six parts: + +- Version +- Leader +- Partition +- Service information +- Partition information +- Long-term task + +Before viewing the cluster information, you need to select any online Graph service address, enter the account to log in to Nebula Graph (not the Dashboard login account), and the corresponding password. + +For multi-machine deployment, you can choose any online Graph service address. + +!!! caution + + You need to ensure that Nebula Graph services have been deployed and started. For more information, see [Nebula Graph installation and deployment](../../4.deployment-and-installation/1.resource-preparations.md "Click to go to Nebula Graph installation and deployment"). + +![information](../figs/ds-006.png) + +## Version + +![Version](../figs/ds-014.png) + +On this page, all services and corresponding Nebula versions will be shown. + +## Leader + +![Leader](../figs/ds-013.png) + +On this page, the number of Leaders and the Leader distribution will be shown. You can click the **Balance Leader** button in the upper right corner to distribute Leaders evenly and quickly in the Nebula Graph cluster. + +## Partition + +![partition](../figs/ds-012.png) + +On this page, you can select the specified graph space and view its distribution of Partitions. + +## Service information + +![Service information](../figs/ds-011.png) + +On this page, the information of Storage services will be shown. You can click the **Balance Date** button in the upper right corner to start the task to distribute all partitions in the cluster evenly. The parameter description is as follows: + +| Parameter | Description | +| :--- | :--- | +| `Host` | The IP address of the host. | +| `Port` | The port of the host. | +| `Status` | The host status. | +| `Git Info Sha` | The commit ID of the current version. | +| `Leader Count` | The number of Leaders. | +| `Partition Distribution` | The distribution of partitions. | +| `Leader Distribution` | The distribution of Leaders. | + +## Partition information + +![Partition information](../figs/ds-010.png) + +On this page, the information of partitions will be shown. Before viewing the partition information, you need to select a graph space in the upper left corner. You can also enter the partition ID into the input box in the upper right corner to filter the shown data. The parameter description is as follows: + +|Parameter|Description| +|:---|:---| +|`Partition ID`|The ID of the partition.| +|`Leader`|The IP address and port of the leader.| +|`Peers`|The IP addresses and ports of all the replicas.| +|`Losts`|The IP addresses and ports of replicas at fault.| + +## Long-term task + +![Long-term task](../figs/ds-009.png) + +On this page, the information of all jobs will be shown. Before viewing the job information, you need to select a graph space in the upper left corner. Online managing jobs is not supported. For more information, see [Job statements](../../3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md). The parameter description is as follows: + +| Parameter | Description | +| :--- | :--- | +| `Job ID` | Shows the Job ID. | +| `Command` | Shows the command type. | +| `Status` | Shows the status of the job or task. For more information, see [Job statements](../../3.ngql-guide/18.operation-and-maintenance-statements/4.job-statements.md#_6). | +|`Start Time`| Shows a timestamp indicating the time when the job or task starts RUNNING.| +| `Stop Time` | Shows a timestamp indicating the time when the job or task gets `FINISHED`, `FAILED`, or`STOPPED`. | diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/4.manage.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/4.manage.md new file mode 100644 index 00000000000..2d64beaf8cf --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/4.manage.md @@ -0,0 +1,65 @@ +# Cluster operation + +This topic introduces the cluster operation of Dashboard. The cluster operation has the following four parts: + +- Node +- Service +- Scale +- Update config + +## Node + +On this page, the information of all nodes will be shown, including the cluster name, Host(SSH_User), CPU (Core), etc. + +- To add a node quickly, click **Add node** and enter the following information, the Host, SSH port, SSH user, SSH password, and select a Nebula Graph package. + +- Click the ![plus](../figs/Plus.png) button to view the process name, service type, status, runtime directory of the corresponding node. + + - Click **Node monitoring** to jump to the detailed node monitoring page. For more information, see [Cluster monitoring](../4.cluster-operator/2.monitor.md). + + - Click **Edit node** to modify the SSH port, SSH user, and SSH password. + + - If a node has no service, you can **delete the node**. + +![vertex manage](../figs/ds-008.png) + +## Service + +- On this page, you can select the service type, service status, and Host to filter the shown data, quickly select one or multiple services, and start/stop/restart the service with one click. + +- Click the ![nav](../figs/nav-dashboard.png) icon to quickly view the [Service monitoring](../4.cluster-operator/2.monitor.md). + +!!! danger + + If you click **Stop**/**Restart**, the running task will be stopped instantly, which may cause data inconsistency. It is recommended to perform this operation during the low peak period of the business. + +![Service](../figs/ds-015.png) + +## Scale + +- On this page, you can **add node** and **import node in batches** quickly, and add **Graph services** and **Storage services** to the existing nodes. +- Click the **Reset** button to restore to the initial state. + +!!! caution + + Currently, you can dynamically scale Storaged and Graphd services through Dashboard. The Metad service cannot be scaled. When scaling a cluster, it is recommended to back up data in advance so that data can be rolled back when scaling fails. For more information, see [FAQ](../../20.appendix/0.FAQ.md#_11). + +In this example, storage services with nodes `192.168.8.143` and `192.168.8.167` are added, and Graph services with node `192.168.8.169` are deleted. If the box is dotted and the service name is greyed, it means the service is removed. If the box is solid, it means the service is newly added. + +In the **services** below, green indicates services that will be added soon, and red indicates services that will be removed. You can modify the port, HTTP port, and HTTP2 port of the newly added service. + +![Scale](../figs/ds-016.png) + +## Update config + +On this page, you can modify configuration files of Storage and Graph services. For more information, see [Storage service configuration](../../5.configurations-and-logs/1.configurations/4.storage-config.md) and [Graph service configuration](../../5.configurations-and-logs/1.configurations/3.graph-config.md). Updating configuration files is a batch operation, and each Storage/Graph configuration file will be modified. + +- After clicking **Save**, the configuration will take effect after the next service restart. + +- Click **Save and restart** to directly restart the service to make the configuration take effect immediately. + + !!! danger + + If you click **Save and Restart**, the running task will be stopped and the cluster will be restarted instantly, which may cause data inconsistency. It is recommended to perform this operation during the low peak period of the business. + +![Update config](../figs/ds-017.png) diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/5.operation-record.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/5.operation-record.md new file mode 100644 index 00000000000..0a86076bc51 --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/5.operation-record.md @@ -0,0 +1,7 @@ +# Operation record + +This topic shows how to use the operation record feature in Nebula Dashboard. + +![operation record](../figs/ds-018.png) + +On the **Operation record** page, you can check the operation records of the latest 1 hour, 6 hours, 1 day, 3 days, 7days, or 14 days. You can also view who runs what operation on which cluster at what time. diff --git a/docs-2.0/nebula-dashboard-ent/4.cluster-operator/6.settings.md b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/6.settings.md new file mode 100644 index 00000000000..3f2324032ad --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/4.cluster-operator/6.settings.md @@ -0,0 +1,21 @@ +# Other settings + +The following shows other settings in Nebula Dashboard. + +- Information: shows the cluster name, the creation time, and the creator. + +- Unbind: Unbind a cluster and remove its information from the platform. The unbound cluster info will be removed and no operations will be done on cluster services or Nebula data. + + !!! note + + To unbind a cluster, enter the cluster name first. + + ![Unbind](../figs/ds-019.png) + +- Delete: Delete a cluster and remove its information from the platform. Deleting the cluster will stop its service and unbind the cluster info, but retain its Nebula data. Be cautious when you delete a cluster. + + !!! note + + To delete a cluster, enter the cluster name first + + ![Delete](../figs/ds-020.png) diff --git a/docs-2.0/nebula-dashboard-ent/8.faq.md b/docs-2.0/nebula-dashboard-ent/8.faq.md new file mode 100644 index 00000000000..0af641669fe --- /dev/null +++ b/docs-2.0/nebula-dashboard-ent/8.faq.md @@ -0,0 +1,51 @@ +# FAQ + +This topic lists the frequently asked questions for using Nebula Dashboard. You can use the search box in the help center or the search function of the browser to match the questions you are looking for. + +## "What are Cluster, Node, and Service?" + +- Cluster: refers to a group of systems composed of nodes where multiple Nebula Graph services are located. + +- Node: refers to the physical or virtual machine hosting Nebula Graph services. + +- Service: refers to Nebula services, including Metad, Storaged, and Graphd services. + +## "What is the cluster status?" + +The status of a cluster is as follows: + +- installing: The cluster is being created. The process will take about 3 to 10 minutes. +- healthy: All services in the cluster are healthy. +- unhealthy: There is an unhealthy service in the cluster service. + +## "Why authorizing nodes?" + +Managing clusters requires the SSH information of the corresponding node. Therefore, you need to have at least an SSH account and the corresponding password with executable permissions before performing operations on Dashboard. + +## "What is scaling?" + +Nebula Graph is a distributed graph database that supports dynamic scaling services at runtime. Therefore, you can dynamically scale Storaged and Graphd services through Dashboard. The Metad service cannot be scaled. + +## "Why cannot operate on the Metad service?" + +The Metad service stores the metadata of the Nebula Graph database. Once the Metad service fails to function, the entire cluster may break down. Besides, the amount of data processed by the Metad service is not much, so it is not recommended to scale the Metad service. And we directly disabled operating on the Metad service in Dashboard to prevent the cluster from being unavailable due to the misoperation of users. + +## "What impact will the scaling have on the data?" + +- Scale out the Storaged service: Dashboard will create and start the Storaged service on the specified machine, which will not affect the existing data. You can choose to perform `Balance Data` on the `Service information` page or `Balance Leader` on the `Leader` page according to your own needs. + +- Scale in the Storaged service: Dashboard will automatically execute `Balance Data Remove` to ensure that the service is stopped after the data partition on the specified service is successfully migrated. + +- Scaling the Graphd service will not affect the data. + +## "Why Dashboard Enterprise Edition cannot be started?" + +- Make sure that the license file is copied to the Dashboard directory and `sudo ./dashboard.service start all` is executed. + +- Make sure that the license is not expired. + +You can also execute `cat logs/webserver.log` in the Dashboard directory to view the startup information of each module. If the above conditions are met but Dashboard still cannot be started, go to [Nebula Graph Official Forum](https://discuss.nebula-graph.io/ "Click to go to Nebula Graph Official Forum") for consultation. + +## "Can I add the Nebula Graph installation package manually?" + +You can add the installation package manually in Dashboard. To download the system and RPM/DEB package you need, see [How to download Nebula Graph](https://nebula-graph.io/download/) and add the package to `dashboard/download/nebula-graph`. And you can select the added package for deployment when creating and scaling out a cluster. diff --git a/docs-2.0/nebula-dashboard-ent/figs/Plus.png b/docs-2.0/nebula-dashboard-ent/figs/Plus.png new file mode 100644 index 00000000000..520a0500527 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/Plus.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/Setup.png b/docs-2.0/nebula-dashboard-ent/figs/Setup.png new file mode 100644 index 00000000000..a309c270da8 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/Setup.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-001.png b/docs-2.0/nebula-dashboard-ent/figs/ds-001.png new file mode 100644 index 00000000000..0b88080db78 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-001.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-002.png b/docs-2.0/nebula-dashboard-ent/figs/ds-002.png new file mode 100644 index 00000000000..248077c010a Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-002.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-003.png b/docs-2.0/nebula-dashboard-ent/figs/ds-003.png new file mode 100644 index 00000000000..f8c0cd8e30b Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-003.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-004.png b/docs-2.0/nebula-dashboard-ent/figs/ds-004.png new file mode 100644 index 00000000000..e739a05a546 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-004.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-005.png b/docs-2.0/nebula-dashboard-ent/figs/ds-005.png new file mode 100644 index 00000000000..0a18f271d47 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-005.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-006.png b/docs-2.0/nebula-dashboard-ent/figs/ds-006.png new file mode 100644 index 00000000000..902595e301e Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-006.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-008.png b/docs-2.0/nebula-dashboard-ent/figs/ds-008.png new file mode 100644 index 00000000000..d7711706b98 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-008.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-009.png b/docs-2.0/nebula-dashboard-ent/figs/ds-009.png new file mode 100644 index 00000000000..3f92ddd353e Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-009.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-010.png b/docs-2.0/nebula-dashboard-ent/figs/ds-010.png new file mode 100644 index 00000000000..d5df8b24878 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-010.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-011.png b/docs-2.0/nebula-dashboard-ent/figs/ds-011.png new file mode 100644 index 00000000000..353cf814c5c Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-011.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-012.png b/docs-2.0/nebula-dashboard-ent/figs/ds-012.png new file mode 100644 index 00000000000..2b9ceeba20a Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-012.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-013.png b/docs-2.0/nebula-dashboard-ent/figs/ds-013.png new file mode 100644 index 00000000000..ee07b7a4fdf Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-013.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-014.png b/docs-2.0/nebula-dashboard-ent/figs/ds-014.png new file mode 100644 index 00000000000..10aab9a570f Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-014.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-015.png b/docs-2.0/nebula-dashboard-ent/figs/ds-015.png new file mode 100644 index 00000000000..f3ccdce05e2 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-015.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-016.png b/docs-2.0/nebula-dashboard-ent/figs/ds-016.png new file mode 100644 index 00000000000..a5373fecf31 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-016.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-017.png b/docs-2.0/nebula-dashboard-ent/figs/ds-017.png new file mode 100644 index 00000000000..6be1ebb81ab Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-017.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-018.png b/docs-2.0/nebula-dashboard-ent/figs/ds-018.png new file mode 100644 index 00000000000..ac39b471bd2 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-018.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-019.png b/docs-2.0/nebula-dashboard-ent/figs/ds-019.png new file mode 100644 index 00000000000..318dadfac9c Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-019.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-020.png b/docs-2.0/nebula-dashboard-ent/figs/ds-020.png new file mode 100644 index 00000000000..7a7523e1f4c Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-020.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-021.png b/docs-2.0/nebula-dashboard-ent/figs/ds-021.png new file mode 100644 index 00000000000..76e44d42bdd Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-021.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-023.png b/docs-2.0/nebula-dashboard-ent/figs/ds-023.png new file mode 100644 index 00000000000..960b666111f Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-023.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-024.png b/docs-2.0/nebula-dashboard-ent/figs/ds-024.png new file mode 100644 index 00000000000..7abcc514e0d Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-024.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-025.png b/docs-2.0/nebula-dashboard-ent/figs/ds-025.png new file mode 100644 index 00000000000..ad9832922ee Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-025.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-026.png b/docs-2.0/nebula-dashboard-ent/figs/ds-026.png new file mode 100644 index 00000000000..e5a51999186 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-026.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-027.png b/docs-2.0/nebula-dashboard-ent/figs/ds-027.png new file mode 100644 index 00000000000..359131bd60e Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-027.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-028.png b/docs-2.0/nebula-dashboard-ent/figs/ds-028.png new file mode 100644 index 00000000000..6f1484188ad Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-028.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-029.png b/docs-2.0/nebula-dashboard-ent/figs/ds-029.png new file mode 100644 index 00000000000..fa5adddae0c Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-029.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/ds-030.png b/docs-2.0/nebula-dashboard-ent/figs/ds-030.png new file mode 100644 index 00000000000..715c6a4d090 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/ds-030.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/nav-dashboard.png b/docs-2.0/nebula-dashboard-ent/figs/nav-dashboard.png new file mode 100644 index 00000000000..af833745435 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/nav-dashboard.png differ diff --git a/docs-2.0/nebula-dashboard-ent/figs/watch.png b/docs-2.0/nebula-dashboard-ent/figs/watch.png new file mode 100644 index 00000000000..a8021b617a9 Binary files /dev/null and b/docs-2.0/nebula-dashboard-ent/figs/watch.png differ diff --git a/docs-2.0/nebula-dashboard/1.what-is-dashboard.md b/docs-2.0/nebula-dashboard/1.what-is-dashboard.md index 44c0cab6207..ff0b09e6d43 100644 --- a/docs-2.0/nebula-dashboard/1.what-is-dashboard.md +++ b/docs-2.0/nebula-dashboard/1.what-is-dashboard.md @@ -1,10 +1,10 @@ # What is Nebula Dashboard Community Edition -Nebula Dashboard (Dashboard for short) is a visualization tool that monitors the status of machines and services in Nebula Graph clusters. This topic introduces Dashboard Community Edition. For details of Dashboard Enterprise Edition, refer to [What is Nebula Dashboard Enterprise Edition](../nebula-dashboard-ent/what-is-dashboard-ent.md). +Nebula Dashboard Community Edition (Dashboard for short) is a visualization tool that monitors the status of machines and services in Nebula Graph clusters. This topic introduces Dashboard Community Edition. For details of Dashboard Enterprise Edition, refer to [What is Nebula Dashboard Enterprise Edition](../nebula-dashboard-ent/1.what-is-dashboard-ent.md). !!! enterpriseonly - Dashboard Enterprise Edition adds features such as visual cluster creation, batch import of clusters, fast scaling, etc. For more information, see [Pricing](https://nebula-graph.io/pricing/)). + Dashboard Enterprise Edition adds features such as visual cluster creation, batch import of clusters, fast scaling, etc. For more information, see [Pricing](https://nebula-graph.io/pricing/). ## Features @@ -37,3 +37,7 @@ You can use Dashboard in one of the following scenarios: !!! note The monitoring service is supported by Prometheus. The update frequency and retention intervals can be modified. For details, see [Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/configuration/). + +## Release note + +[Release](https://github.com/vesoft-inc/nebula-dashboard/releases/tag/{{dashboard.branch}}) diff --git a/docs-2.0/nebula-dashboard/2.deploy-dashboard.md b/docs-2.0/nebula-dashboard/2.deploy-dashboard.md index 1434250ef52..2d4047be329 100644 --- a/docs-2.0/nebula-dashboard/2.deploy-dashboard.md +++ b/docs-2.0/nebula-dashboard/2.deploy-dashboard.md @@ -42,13 +42,13 @@ Download the tar package as needed, and it is recommended to select the latest v Run `tar -xvf {{dashboard.release}}.tar.gz` to decompress the installation package. There are 5 services in the `nebula-graph-dashboard`. The descriptions are as follows. -|Name|Description| -|:---|:---| -|node-exporter | Collects the source information of machines in the cluster, including the CPU, memory, load, disk, and network. | -|nebula-stats-exporter | Collects the performance metrics in the cluster, including the IP addresses, versions, and monitoring metrics (such as the number of queries, the latency of queries, the latency of heartbeats, and so on). | -|prometheus | The time series database that stores monitoring data. | -|nebula-http-gateway | Provides HTTP ports for cluster services to execute nGQL statements to interact with the Nebula Graph database. | -|nebula-graph-dashboard| Provides the Dashboard service. Note that its name is the same as its superordinate. The following `nebula-graph-dashboard` refers to this service. | +|Name|Description||Port| +|:---|:---|:---| +|node-exporter | Collects the source information of machines in the cluster, including the CPU, memory, load, disk, and network. |9100| +|nebula-stats-exporter | Collects the performance metrics in the cluster, including the IP addresses, versions, and monitoring metrics (such as the number of queries, the latency of queries, the latency of heartbeats, and so on). |9200| +|prometheus | The time series database that stores monitoring data. |9090| +|nebula-http-gateway | Provides HTTP ports for cluster services to execute nGQL statements to interact with the Nebula Graph database. |8090| +|nebula-graph-dashboard| Provides the Dashboard service. Note that its name is the same as its superordinate. The following `nebula-graph-dashboard` refers to this service. |7003| The above five services should be deployed as follows. diff --git a/docs-2.0/nebula-exchange/about-exchange/ex-ug-limitations.md b/docs-2.0/nebula-exchange/about-exchange/ex-ug-limitations.md index 86cf5888115..a2762c6507a 100644 --- a/docs-2.0/nebula-exchange/about-exchange/ex-ug-limitations.md +++ b/docs-2.0/nebula-exchange/about-exchange/ex-ug-limitations.md @@ -2,15 +2,16 @@ This topic describes some of the limitations of using Exchange 2.x. -## Nebula Graph releases +## Version compatibility -The correspondence between the Nebula Exchange release (the JAR version) and the Nebula Graph release is as follows. +The correspondence between the Nebula Exchange release (the JAR version) and the Nebula Graph core release is as follows. |Exchange client|Nebula Graph| |:---|:---| |2.5-SNAPSHOT|nightly| -|{{exchange.release}}|{{nebula.release}}, 2.5.0| -|2.5.0|2.5.0| +|{{exchange.release}}|2.6.0, {{nebula.release}}| +|2.5.1|2.5.0, 2.5.1| +|2.5.0|2.5.0, 2.5.1| |2.1.0|2.0.0, 2.0.1| |2.0.1|2.0.0, 2.0.1| |2.0.0|2.0.0, 2.0.1| diff --git a/docs-2.0/nebula-exchange/about-exchange/ex-ug-terms.md b/docs-2.0/nebula-exchange/about-exchange/ex-ug-terms.md deleted file mode 100644 index d74b194b489..00000000000 --- a/docs-2.0/nebula-exchange/about-exchange/ex-ug-terms.md +++ /dev/null @@ -1,9 +0,0 @@ -# Explanations of terms - -This topic explains the terms that users may need to know when using Exchange. - -- Nebula Exchange (Exchange or Exchange 2.x for short): It is a Spark application based on Apache Spark™ used for bulk data migration. It supports converting files from a variety of different sources and formats into data of vertices and edges that Nebula Graph can recognize, and then concurrently importing them into Nebula Graph. - -- Aparch Spark™: It is a fast and universal computing engine designed for large-scale data processing. It is an open source project of the Apache Software Foundation. - -- Driver Program (Driver for short): It is a program that runs the main function of the application and creates a new SparkContext example. diff --git a/docs-2.0/nebula-exchange/about-exchange/ex-ug-what-is-exchange.md b/docs-2.0/nebula-exchange/about-exchange/ex-ug-what-is-exchange.md index 3d3b49b02f3..7aded044792 100644 --- a/docs-2.0/nebula-exchange/about-exchange/ex-ug-what-is-exchange.md +++ b/docs-2.0/nebula-exchange/about-exchange/ex-ug-what-is-exchange.md @@ -6,6 +6,10 @@ Exchange consists of Reader, Processor, and Writer. After Reader reads data from ![Nebula Graph® Exchange consists of Reader, Processor, and Writer that can migrate data from a variety of formats and sources to Nebula Graph](../figs/ex-ug-003.png) +## Editions + +Exchange has two editions, the Community Edition and the Enterprise Edition. The Community Edition is open source developed on [GitHub](https://github.com/vesoft-inc/nebula-exchange). The Enterprise Edition supports not only the functions of the Community Edition but also adds additional features. For details, see [Comparisons](https://nebula-graph.com.cn/pricing/). + ## Scenarios Exchange applies to the following scenarios: @@ -16,6 +20,12 @@ Exchange applies to the following scenarios: - A large volume of data needs to be generated into SST files that Nebula Graph can recognize and then imported into the Nebula Graph database. +- The data saved in Nebula Graph needs to be exported. + + !!! enterpriseonly + + Exporting the data saved in Nebula Graph is supported by Exchange Enterprise Edition only. + ## Advantages Exchange has the following advantages: @@ -24,6 +34,8 @@ Exchange has the following advantages: - SST import: It supports converting data from different sources into SST files for data import. +- SSL encryption: It supports establishing the SSL encryption between Exchange and Nebula Graph to ensure data security. + - Resumable data import: It supports resumable data import to save time and improve data import efficiency. !!! note @@ -40,7 +52,7 @@ Exchange has the following advantages: ## Data source -Exchange {{exchange.release}} supports converting data from the following formats or sources into vertexes and edges that Nebula Graph can recognize, and then importing them into Nebula Graph in the form of **nGQL** statements: +Exchange {{exchange.release}} supports converting data from the following formats or sources into vertexes and edges that Nebula Graph can recognize, and then importing them into Nebula Graph in the form of nGQL statements: - Data stored in HDFS or locally: - [Apache Parquet](../use-exchange/ex-ug-import-from-parquet.md) @@ -65,4 +77,10 @@ Exchange {{exchange.release}} supports converting data from the following format - Publish/Subscribe messaging platform: [Apache Pulsar 2.4.5](../use-exchange/ex-ug-import-from-pulsar.md) -In addition to importing data as nGQL statements, Exchange supports generating **SST files** for data sources and then [importing SST](../use-exchange/ex-ug-import-from-sst.md) files via Console. +In addition to importing data as nGQL statements, Exchange supports generating SST files for data sources and then [importing SST](../use-exchange/ex-ug-import-from-sst.md) files via Console. + +In addition, Exchange Enterprise Edition also supports [exporting data to a CSV file](../use-exchange/ex-ug-export-from-nebula.md) using Nebula Graph as data sources. + +## Release note + +[Release](https://github.com/vesoft-inc/nebula-exchange/releases/tag/{{exchange.tag}}) diff --git a/docs-2.0/nebula-exchange/ex-ug-compile.md b/docs-2.0/nebula-exchange/ex-ug-compile.md index 7606fa67df8..a8b4233561b 100644 --- a/docs-2.0/nebula-exchange/ex-ug-compile.md +++ b/docs-2.0/nebula-exchange/ex-ug-compile.md @@ -1,8 +1,22 @@ -# Compile Exchange +# Get Exchange -This topic describes how to compile Nebula Exchange. Users can also [download](https://repo1.maven.org/maven2/com/vesoft/nebula-exchange/) the compiled `.jar` file directly. +This topic introduces how to get the JAR file of Nebula Exchange. -## Prerequisites +## Download the JAR file directly + +The JAR file of Exchange Community Edition can be [downloaded](https://repo1.maven.org/maven2/com/vesoft/nebula-exchange/) directly. + +To download Exchange Enterprise Edition, [get Nebula Graph Enterprise Edition Package](https://nebula-graph.com.cn/pricing/) first. + +## Get the JAR file by compiling the source code + +You can get the JAR file of Exchange Community Edition by compiling the source code. The following introduces how to compile the source code of Exchange. + +!!! enterpriseonly + + You can get Exchange Enterprise Edition in Nebula Graph Enterprise Edition Package only. + +### Prerequisites - Install [Maven](https://maven.apache.org/download.cgi). @@ -58,7 +72,7 @@ In the `target` directory, users can find the `exchange-2.x.y.jar` file. When migrating data, you can refer to configuration file [`target/classes/application.conf`](https://github.com/vesoft-inc/nebula-exchange/blob/master/nebula-exchange/src/main/resources/application.conf). -## Failed to download the dependency package +### Failed to download the dependency package If downloading dependencies fails when compiling: diff --git a/docs-2.0/nebula-exchange/ex-ug-toc.md b/docs-2.0/nebula-exchange/ex-ug-toc.md deleted file mode 100644 index 3b896668563..00000000000 --- a/docs-2.0/nebula-exchange/ex-ug-toc.md +++ /dev/null @@ -1,24 +0,0 @@ -# Nebula Exchange Manual - -- About Nebula Exchange - - [What is Nebula Exchange](about-exchange/ex-ug-what-is-exchange.md) - - [Limitations](about-exchange/ex-ug-limitations.md) - - [Explanations of terms](about-exchange/ex-ug-terms.md) -- [Compile Exchange](ex-ug-compile.md) -- Use Nebula Exchange - - [Import from Apache Parquet](use-exchange/ex-ug-import-from-parquet.md) - - [Import from Apache ORC](use-exchange/ex-ug-import-from-orc.md) - - [Import from JSON](use-exchange/ex-ug-import-from-json.md) - - [Import from CSV](use-exchange/ex-ug-import-from-csv.md) - - [Import from Neo4j](use-exchange/ex-ug-import-from-neo4j.md) - - [Import from Apache HBase™](use-exchange/ex-ug-import-from-hbase.md) - - [Import from Hive](use-exchange/ex-ug-import-from-hive.md) - - [Import from MySQL](use-exchange/ex-ug-import-from-mysql.md) - - [Import from Kafka](use-exchange/ex-ug-import-from-kafka.md) - - [Import from Pulsar](use-exchange/ex-ug-import-from-pulsar.md) - - Import from SST files (TODO:doc) -- Parameter reference - - [Parameters](parameter-reference/ex-ug-parameter.md) - - [Import command parameters](parameter-reference/ex-ug-para-import-command.md) -- [FAQ](ex-ug-FAQ.md) -- Error information(TODO:doc) diff --git a/docs-2.0/nebula-exchange/parameter-reference/ex-ug-parameter.md b/docs-2.0/nebula-exchange/parameter-reference/ex-ug-parameter.md index c07fab42565..20505348af2 100644 --- a/docs-2.0/nebula-exchange/parameter-reference/ex-ug-parameter.md +++ b/docs-2.0/nebula-exchange/parameter-reference/ex-ug-parameter.md @@ -49,6 +49,14 @@ Users only need to configure parameters for connecting to Hive if Spark and Hive |`nebula.user`|string|-|Yes|The username with write permissions for Nebula Graph.| |`nebula.pswd`|string|-|Yes|The account password.| |`nebula.space`|string|-|Yes|The name of the graph space where data needs to be imported.| +|`nebula.ssl.enable.graph`|bool|`false`|Yes|Enables the [SSL encryption](https://en.wikipedia.org/wiki/Transport_Layer_Security) between Exchange and Graph services. If the value is `true`, the SSL encryption is enabled and the following SSL parameters take effect. If Exchange is run on a multi-machine cluster, you need to store the corresponding files in the same path on each machine when setting the following SSL-related paths.| +|`nebula.ssl.sign`|string|`ca`|Yes|Specifies the SSL sign. Optional values are `ca` and `self`.| +|`nebula.ssl.ca.param.caCrtFilePath`|string|Specifies the storage path of the CA certificate. It takes effect when the value of `nebula.ssl.sign` is `ca`.| +|`nebula.ssl.ca.param.crtFilePath`|string|`"/path/crtFilePath"`|Yes|Specifies the storage path of the CRT certificate. It takes effect when the value of `nebula.ssl.sign` is `ca`.| +|`nebula.ssl.ca.param.keyFilePath`|string|`"/path/keyFilePath"`|Yes|Specifies the storage path of the key file. It takes effect when the value of `nebula.ssl.sign` is `ca`.| +|`nebula.ssl.self.param.crtFilePath`|string|`"/path/crtFilePath"`|Yes|Specifies the storage path of the CRT certificate. It takes effect when the value of `nebula.ssl.sign` is `self`.| +|`nebula.ssl.self.param.keyFilePath`|string|`"/path/keyFilePath"`|Yes|Specifies the storage path of the key file. It takes effect when the value of `nebula.ssl.sign` is `self`.| +|`nebula.ssl.self.param.password`|string|`"nebula"`|Yes|Specifies the storage path of the password. It takes effect when the value of `nebula.ssl.sign` is `self`.| |`nebula.path.local`|string|`"/tmp"`|No|The local SST file path which needs to be set when users import SST files.| |`nebula.path.remote`|string|`"/sst"`|No|The remote SST file path which needs to be set when users import SST files.| |`nebula.path.hdfs.namenode`|string|`"hdfs://name_node:9000"`|No|The NameNode path which needs to be set when users import SST files.| @@ -150,7 +158,7 @@ For different data sources, the vertex configurations are different. There are m |`tags.host`|string|`127.0.0.1`|Yes|The Hbase server address.| |`tags.port`|string|`2181`|Yes|The Hbase server port. |`tags.table`|string|-|Yes|The name of a table used as a data source.| -|`tags.columnFamily`|string|-|Yes|The column family which a table belongs to.| +|`tags.columnFamily`|string|-|Yes|The column family to which a table belongs.| ### Specific parameters of Pulsar data sources @@ -175,6 +183,18 @@ For different data sources, the vertex configurations are different. There are m |:---|:---|:---|:---|:---| |`tags.path`|string|-|Yes|The path of the source file specified to generate SST files.| +### Specific parameters of Nebula Graph + +!!! enterpriseonly + + Specific parameters of Nebula Graph are used for exporting Nebula Graph data, which is supported by Exchange Enterprise Edition only. + +|Parameter|Data type|Default value|Required|Description| +|:---|:---|:---|:---|:---| +|`tags.path`|string|`"hdfs://namenode:9000/path/vertex"`|Yes|Specifies the storage path of the CSV file. You need to set a new path and Exchange will automatically create the path you set. If you store the data to the HDFS server, the path format is the same as the default value, such as `"hdfs://192.168.8.177:9000/vertex/player"`. If you store the data to the local, the path format is `"file:///path/vertex"`, such as `"file:///home/nebula/vertex/player"`. If there are multiple Tags, different directories must be set for each Tag.| +|`tags.noField`|bool|`false`|Yes|If the value is `true`, only VIDs will be exported, not the property data. If the value is `false`, VIDs and the property data will be exported.| +|`tags.return.fields`|list|`[]`|Yes|Specifies the properties to be exported. For example, to export the `name` and `age`, you need to set the parameter value to `["name","age"]`. This parameter only takes effect when the value of `tags.noField` is `false`.| + ## Edge configurations For different data sources, configurations of edges are also different. There are general parameters and some specific parameters. General parameters and specific parameters of different data sources need to be configured when users configure edges. @@ -195,3 +215,11 @@ For the specific parameters of different data sources for edge configurations, p |`edges.ranking`|int|-|No|The column of rank values. If not specified, all rank values are `0` by default.| |`edges.batch`|int|`256`|Yes|The maximum number of edges written into Nebula Graph in a single batch.| |`edges.partition`|int|`32`|Yes|The number of Spark partitions.| + +### Specific parameters of Nebula Graph + +|Parameter|Type|Default value|Required|Description| +|:---|:---|:---|:---|:---| +|`edges.path`|string|`"hdfs://namenode:9000/path/edge"`|Yes|Specifies the storage path of the CSV file. You need to set a new path and Exchange will automatically create the path you set. If you store the data to the HDFS server, the path format is the same as the default value, such as `"hdfs://192.168.8.177:9000/edge/follow"`. If you store the data to the local, the path format is `"file:///path/edge"`, such as `"file:///home/nebula/edge/follow"`. If there are multiple Edges, different directories must be set for each Edge.| +|`edges.noField`|bool|`false`|Yes|If the value is `true`, source vertex IDs, destination vertex IDs, and ranks will be exported, not the property data. If the vaue is `false`, ranks, source vertex IDs, destination vertex IDs, ranks, and the property data will be exported.| +|`edges.return.fields`|list|`[]`|Yes|Specifies the properties to be exported. For example, to export `start_year` and `end_year`, you need to set the parameter value to `["start_year","end_year"]`. This parameter only takes effect when the value of `edges.noField` is `false`.| diff --git a/docs-2.0/nebula-exchange/use-exchange/ex-ug-export-from-nebula.md b/docs-2.0/nebula-exchange/use-exchange/ex-ug-export-from-nebula.md new file mode 100644 index 00000000000..f1ffcc2b114 --- /dev/null +++ b/docs-2.0/nebula-exchange/use-exchange/ex-ug-export-from-nebula.md @@ -0,0 +1,148 @@ +# Export data from Nebula Graph + +This topic uses an example to illustrate how to use Exchange to export data from Nebula Graph to a CSV file. + +!!! enterpriseonly + + Only Exchange Enterprise Edition supports exporting data from Nebula Graph to a CSV file. + +!!! note + + SSL encryption is not supported when exporting data from Nebula Graph. + +## Preparation + +This example is completed on a virtual machine equipped with Linux. The hardware and software you need to prepare before exporting data are as follows. + +### Hardware + +| Type | Information | +| - | - | +| CPU | 4 Intel(R) Xeon(R) Platinum 8260 CPU @ 2.30GHz | +| Memory | 16G | +| Hard disk | 50G | + +### System + +CentOS 7.9.2009 + +### Software + +| Name | Version | +| - | - | +| JDK | 1.8.0 | +| Hadoop | 2.10.1 | +| Scala | 2.12.11 | +| Spark | 2.4.7 | +| Nebula Graph | {{nebula.release}} | + +### Dataset + +As the data source, Nebula Graph stores the [basketballplayer dataset](https://docs.nebula-graph.io/2.0/basketballplayer-2.X.ngql) in this example, the Schema elements of which are shown as follows. + +| Element | Name | Property | +| :--- | :--- | :--- | +| Tag | `player` | `name string, age int` | +| Tag | `team` | `name string` | +| Edge type | `follow` | `degree int` | +| Edge type | `serve` | `start_year int, end_year int` | + +## Steps + +1. Get the JAR file of Exchange Enterprise Edition from the [Nebula Graph Enterprise Edition Package](https://nebula-graph.com.cn/pricing/). + +2. Modify the configuration file. + + Exchange Enterprise Edition provides the configuration template `export_application.conf` for exporting Nebula Graph data. For details, see [Exchange parameters](../parameter-reference/ex-ug-parameter.md). The core content of the configuration file used in this example is as follows: + + ```conf + ... + + # Processing tags + # There are tag config examples for different dataSources. + tags: [ + # export NebulaGraph tag data to csv, only support export to CSV for now. + { + name: player + type: { + source: Nebula + sink: CSV + } + # the path to save the NebulaGrpah data, make sure the path doesn't exist. + path:"hdfs://192.168.8.177:9000/vertex/player" + # if no need to export any properties when export NebulaGraph tag data + # if noField is configured true, just export vertexId + noField:false + # define properties to export from NebulaGraph tag data + # if return.fields is configured as empty list, then export all properties + return.fields:[] + # nebula space partition number + partition:10 + } + + ... + + ] + + # Processing edges + # There are edge config examples for different dataSources. + edges: [ + # export NebulaGraph tag data to csv, only support export to CSV for now. + { + name: follow + type: { + source: Nebula + sink: CSV + } + # the path to save the NebulaGrpah data, make sure the path doesn't exist. + path:"hdfs://192.168.8.177:9000/edge/follow" + # if no need to export any properties when export NebulaGraph edge data + # if noField is configured true, just export src,dst,rank + noField:false + # define properties to export from NebulaGraph edge data + # if return.fields is configured as empty list, then export all properties + return.fields:[] + # nebula space partition number + partition:10 + } + + ... + + ] + } + ``` + +3. Export data from Nebula Graph with the following command. + + ```bash + /bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange nebula-exchange-x.y.z.jar_path> -c + ``` + + The command used in this example is as follows. + + ```bash + $ ./spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange \ + ~/exchange-ent/nebula-exchange-ent-{{exchange.release}}.jar -c ~/exchange-ent/export_application.conf + ``` + +4. Check the exported data. + + 1. Check whether the CSV file is successfully generated under the target path. + + ```bash + $ hadoop fs -ls /vertex/player + Found 11 items + -rw-r--r-- 3 nebula supergroup 0 2021-11-05 07:36 /vertex/player/_SUCCESS + -rw-r--r-- 3 nebula supergroup 160 2021-11-05 07:36 /vertex/player/ part-00000-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 163 2021-11-05 07:36 /vertex/player/ part-00001-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 172 2021-11-05 07:36 /vertex/player/ part-00002-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 172 2021-11-05 07:36 /vertex/player/ part-00003-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 144 2021-11-05 07:36 /vertex/player/ part-00004-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 173 2021-11-05 07:36 /vertex/player/ part-00005-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 160 2021-11-05 07:36 /vertex/player/ part-00006-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 148 2021-11-05 07:36 /vertex/player/ part-00007-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 125 2021-11-05 07:36 /vertex/player/ part-00008-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + -rw-r--r-- 3 nebula supergroup 119 2021-11-05 07:36 /vertex/player/ part-00009-17293020-ba2e-4243-b834-34495c0536b3-c000.csv + ``` + + 2. Check the contents of the CSV file to ensure that the data export is successful. diff --git a/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md b/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md index 7e090e792a2..428a73b44a6 100644 --- a/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md +++ b/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md @@ -103,6 +103,8 @@ Before importing data, you need to confirm the following information: - To generate SST files only, users do not need to install the Hadoop service on the machine where the Storage service is deployed. + - To delete the SST file after the ingest (data import) operation, add the configuration `-- move_Files =true` to the Storage Service configuration file. + ## Steps ### Step 1: Create the Schema in Nebula Graph @@ -442,9 +444,13 @@ After Exchange is compiled, copy the conf file `target/classes/application.conf` Run the following command to generate the SST file from the CSV source file. For a description of the parameters, see [Options for import](../parameter-reference/ex-ug-para-import-command.md). ```bash -${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange -c +${SPARK_HOME}/bin/spark-submit --master "local" --conf spark.sql.shuffle.partition= --class com.vesoft.nebula.exchange.Exchange -c ``` +!!! note + + When generating SST files, the shuffle operation of Spark will be involved. Note that the configuration of `spark.sql.shuffle.partition` should be added when you submit the command. + !!! note JAR packages are available in two ways: [compiled them yourself](../ex-ug-compile.md), or [download](https://repo1.maven.org/maven2/com/vesoft/nebula-exchange/) the compiled `.jar` file directly. @@ -452,7 +458,7 @@ ${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchan For example: ```bash -${SPARK_HOME}/bin/spark-submit --master "local" --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange-{{exchange.release}}.jar -c /root/nebula-exchange/nebula-exchange/target/classes/sst_application.conf +${SPARK_HOME}/bin/spark-submit --master "local" --conf spark.sql.shuffle.partition=200 --class com.vesoft.nebula.exchange.Exchange /root/nebula-exchange/nebula-exchange/target/nebula-exchange-{{exchange.release}}.jar -c /root/nebula-exchange/nebula-exchange/target/classes/sst_application.conf ``` After the task is complete, you can view the generated SST file in the `/sst` directory (specified by the `nebula.path.remote` parameter) on HDFS. diff --git a/docs-2.0/nebula-flink-connector.md b/docs-2.0/nebula-flink-connector.md index 28e53d9d0d9..4550138acef 100644 --- a/docs-2.0/nebula-flink-connector.md +++ b/docs-2.0/nebula-flink-connector.md @@ -13,4 +13,8 @@ Nebula Flink Connector applies to the following scenarios: * Migrate data between different graph spaces in the same Nebula Graph cluster. -* Migrate data between Nebula Graph and other data sources. \ No newline at end of file +* Migrate data between Nebula Graph and other data sources. + +## Release note + +[Release](https://github.com/vesoft-inc/nebula-flink-connector/releases/tag/{{flinkconnector.tag}}) \ No newline at end of file diff --git a/docs-2.0/nebula-importer/use-importer.md b/docs-2.0/nebula-importer/use-importer.md index c72871c39be..64f16c9933f 100644 --- a/docs-2.0/nebula-importer/use-importer.md +++ b/docs-2.0/nebula-importer/use-importer.md @@ -12,6 +12,10 @@ Importer is used to import the contents of a local CSV file into the Nebula Grap - Flexible filtering: You can flexibly filter CSV data through configuration files. +## Release note + +[Release](https://github.com/vesoft-inc/nebula-importer/releases/tag/{{importer.branch}}) + ## Prerequisites Before using Nebula Importer, make sure: @@ -32,6 +36,16 @@ Before using Nebula Importer, make sure: Configure the YAML file and prepare the CSV file to be imported to use the tool to batch write data to Nebula Graph. +### Download binary package and run + +1. Download the [binary package](https://github.com/vesoft-inc/nebula-importer/releases/tag/{{importer.branch}}) directly and add execute permission to it. + +2. Start the service. + + ```bash + $ ./ --config + ``` + ### Source code compile and run 1. Clone repository. @@ -121,6 +135,10 @@ $ docker run --rm -ti \ Nebula Importer uses configuration(`nebula-importer/examples/v2/example.yaml`) files to describe information about the files to be imported, the Nebula Graph server, and more. You can refer to the example configuration file: [Configuration without Header](config-without-header.md)/[Configuration with Header](config-with-header.md). This section describes the fields in the configuration file by category. +!!! note + + If users download a binary package, create the configuration file manually. + ### Basic configuration The example configuration is as follows: diff --git a/docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md b/docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md index 2c2b9f141a8..02cf30f935c 100644 --- a/docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md +++ b/docs-2.0/nebula-operator/1.introduction-to-nebula-operator.md @@ -38,3 +38,7 @@ Nebula Operator does not support the v1.x version of Nebula Graph. Nebula Operat ### Feature limitations Nebula Operator currently only supports manual scaling of Nebula Graph clusters, and does not support automatic scaling of Nebula Graph clusters. + +## Release note + +[Release](https://github.com/vesoft-inc/nebula-operator/releases/tag/{{operator.branch}}) \ No newline at end of file diff --git a/docs-2.0/nebula-operator/4.connect-to-nebula-graph-service.md b/docs-2.0/nebula-operator/4.connect-to-nebula-graph-service.md index 0fc44bd49ce..cd76a52a5bb 100644 --- a/docs-2.0/nebula-operator/4.connect-to-nebula-graph-service.md +++ b/docs-2.0/nebula-operator/4.connect-to-nebula-graph-service.md @@ -233,4 +233,4 @@ Steps are as follows. ```bash If you don't see a command prompt, try pressing enter. (root@nebula) [(none)]> - ``` \ No newline at end of file + ``` diff --git a/docs-2.0/nebula-spark-connector.md b/docs-2.0/nebula-spark-connector.md index 0a0cb342faf..e7e50c6ec2d 100644 --- a/docs-2.0/nebula-spark-connector.md +++ b/docs-2.0/nebula-spark-connector.md @@ -40,6 +40,10 @@ The features of Nebula Spark Connector {{sparkconnector.release}} are as follows * Three write modes, `insert`, `update` and `delete`, are supported. `insert` mode will insert (overwrite) data, `update` mode will only update existing data, and `delete` mode will only delete data. +## Release note + +[Release](https://github.com/vesoft-inc/nebula-spark-connector/releases/tag/{{sparkconnector.tag}}) + ## Get Nebula Spark Connector ### Compile package @@ -144,6 +148,10 @@ val edge = spark.read.nebula(config, nebulaReadEdgeConfig).loadEdgesToDF() ### Write data into Nebula Graph +!!! note + + The values of columns in a dataframe are automatically written to the Nebula Graph as property values. + ```scala val config = NebulaConnectionConfig .builder() diff --git a/docs-2.0/nebula-studio/about-studio/st-ug-limitations.md b/docs-2.0/nebula-studio/about-studio/st-ug-limitations.md index 318c1bdcac6..4a9ae8d5ad0 100644 --- a/docs-2.0/nebula-studio/about-studio/st-ug-limitations.md +++ b/docs-2.0/nebula-studio/about-studio/st-ug-limitations.md @@ -14,6 +14,7 @@ This topic introduces the limitations of Studio. | 2.0 & 2.0.1 | 2.x | | 2.5.0 & 2.5.1 | 3.0.0 | | 2.6.0 | 3.1.0 | +| 2.6.1 | 3.1.0 | ## Architecture diff --git a/docs-2.0/nebula-studio/about-studio/st-ug-what-is-graph-studio.md b/docs-2.0/nebula-studio/about-studio/st-ug-what-is-graph-studio.md index cbd182b0389..30516aa0682 100644 --- a/docs-2.0/nebula-studio/about-studio/st-ug-what-is-graph-studio.md +++ b/docs-2.0/nebula-studio/about-studio/st-ug-what-is-graph-studio.md @@ -42,6 +42,7 @@ You can use Studio in one of these scenarios: - You are a beginner of nGQL (Nebula Graph Query Language) and you prefer to use a GUI rather than a command-line interface (CLI) to learn the language. ## Authentication + diff --git a/docs-2.0/nebula-studio/st-ug-toc.md b/docs-2.0/nebula-studio/st-ug-toc.md deleted file mode 100644 index ee43ef8b184..00000000000 --- a/docs-2.0/nebula-studio/st-ug-toc.md +++ /dev/null @@ -1,36 +0,0 @@ - \ No newline at end of file diff --git a/docs-2.0/reuse/assets-1.png b/docs-2.0/reuse/assets-1.png new file mode 100644 index 00000000000..b84bb1ae10c Binary files /dev/null and b/docs-2.0/reuse/assets-1.png differ diff --git a/docs-2.0/reuse/assets.png b/docs-2.0/reuse/assets.png deleted file mode 100644 index f0dba0f5374..00000000000 Binary files a/docs-2.0/reuse/assets.png and /dev/null differ diff --git a/docs-2.0/reuse/console-1.png b/docs-2.0/reuse/console-1.png index 5f21b0c2e1d..921cb397877 100644 Binary files a/docs-2.0/reuse/console-1.png and b/docs-2.0/reuse/console-1.png differ diff --git a/docs-2.0/reuse/console.png b/docs-2.0/reuse/console.png deleted file mode 100644 index 3f08d4ba19b..00000000000 Binary files a/docs-2.0/reuse/console.png and /dev/null differ diff --git a/docs-2.0/reuse/source_connect-to-nebula-graph.md b/docs-2.0/reuse/source_connect-to-nebula-graph.md index 81677b28622..be66883cdbc 100644 --- a/docs-2.0/reuse/source_connect-to-nebula-graph.md +++ b/docs-2.0/reuse/source_connect-to-nebula-graph.md @@ -23,11 +23,11 @@ If you don't have a Nebula Graph database yet, we recommend that you try the clo We recommend that you select the **latest** release. - ![Select a Nebula Graph version and click **Assets**](https://docs-cdn.nebula-graph.com.cn/docs-2.0/2.quick-start/nebula-console-releases-1.png "Click Assets to show the available Nebula Graph binary files") + ![Select a Nebula Graph version and click **Assets**](../reuse/console-1.png "Click Assets to show the available Nebula Graph binary files") 2. In the **Assets** area, find the correct binary file for the machine where you want to run Nebula Console and download the file to the machine. - ![Click to download the package according to your hardware architecture](https://docs-cdn.nebula-graph.com.cn/docs-2.0/2.quick-start/nebula-console-releases-2-1.png "Click the package name to download it") + ![Click to download the package according to your hardware architecture](../reuse/assets-1.png "Click the package name to download it") 3. (Optional) Rename the binary file to `nebula-console` for convenience. @@ -76,7 +76,7 @@ If you don't have a Nebula Graph database yet, we recommend that you try the clo | `-e/-eval` | Sets a string-type nGQL statement. The nGQL statement is executed once the connection succeeds. The connection stops after the result is returned. | | `-f/-file` | Sets the path of an nGQL file. The nGQL statements in the file are executed once the connection succeeds. You'll get the return messages and the connection stops then. | -You can find more details in the [Nebula Console Repository](https://github.com/vesoft-inc/nebula-console/tree/v2.0.0-ga). +You can find more details in the [Nebula Console Repository](https://github.com/vesoft-inc/nebula-console/tree/{{console.branch}}). ## Nebula Console commands @@ -88,6 +88,8 @@ Nebula Console can export CSV file, DOT file, and import too. ### Export a CSV file +CSV files save the return result of a executed command. + !!! note - A CSV file will be saved in the working directory, i.e., what linux command `pwd` show; @@ -102,6 +104,8 @@ nebula> :CSV ### Export a DOT file +DOT files save the return result of a executed command, and the result information is different from CSV files. + !!! Note - A DOT file will be saved in the working directory, i.e., what linux command `pwd` show; diff --git a/docs-2.0/reuse/source_install-nebula-graph-by-rpm-or-deb.md b/docs-2.0/reuse/source_install-nebula-graph-by-rpm-or-deb.md index 1b5f9937216..b771ae48718 100644 --- a/docs-2.0/reuse/source_install-nebula-graph-by-rpm-or-deb.md +++ b/docs-2.0/reuse/source_install-nebula-graph-by-rpm-or-deb.md @@ -121,15 +121,27 @@ Prepare the right [resources](https://docs.nebula-graph.io/{{nebula.release}}/4. * Use the following syntax to install with an RPM package. - ```bash - sudo rpm -ivh --prefix= - ``` + ```bash + $ sudo rpm -ivh --prefix= + ``` + + For example, to install an RPM package in the default path for the {{nebula.release}} version. + + ```bash + sudo rpm -ivh nebula-graph-{{nebula.release}}.el7.x86_64.rpm + ``` * Use the following syntax to install with a DEB package. - ```bash - sudo dpkg -i --instdir== - ``` + ```bash + $ sudo dpkg -i --instdir== + ``` + + For example, to install a DEB package in the default path for the {{nebula.release}} version. + + ```bash + sudo dpkg -i nebula-graph-{{nebula.release}}.ubuntu1804.amd64.deb + ``` !!! note @@ -137,5 +149,6 @@ Prepare the right [resources](https://docs.nebula-graph.io/{{nebula.release}}/4. ## What's next +- (Enterprise Edition)[Deploy license](https://docs.nebula-graph.com.cn/{{nebula.release}}/4.deployment-and-installation/deploy-license) - [start Nebula Graph](https://docs.nebula-graph.io/{{nebula.release}}/2.quick-start/5.start-stop-service/) - [connect to Nebula Graph](https://docs.nebula-graph.io/{{nebula.release}}/2.quick-start/3.connect-to-nebula-graph/) diff --git a/docs-2.0/reuse/source_manage-service.md b/docs-2.0/reuse/source_manage-service.md index 76b5f13125f..2f0f10c7b25 100644 --- a/docs-2.0/reuse/source_manage-service.md +++ b/docs-2.0/reuse/source_manage-service.md @@ -122,17 +122,17 @@ $ sudo /usr/local/nebula/scripts/nebula.service status all * Nebula Graph is running normally if the following information is returned. ```bash -[INFO] nebula-metad: Running as 26601, Listening on 9559 -[INFO] nebula-graphd: Running as 26644, Listening on 9669 -[INFO] nebula-storaged: Running as 26709, Listening on 9779 +[INFO] nebula-metad(3ba41bd): Running as 26601, Listening on 9559 +[INFO] nebula-graphd(3ba41bd): Running as 26644, Listening on 9669 +[INFO] nebula-storaged(3ba41bd): Running as 26709, Listening on 9779 ``` * If the return information is similar to the following one, there is a problem. ```bash -[INFO] nebula-metad: Running as 25600, Listening on 9559 -[INFO] nebula-graphd: Exited -[INFO] nebula-storaged: Running as 25646, Listening on 9779 +[INFO] nebula-metad(de03025): Running as 25600, Listening on 9559 +[INFO] nebula-graphd(de03025): Exited +[INFO] nebula-storaged(de03025): Running as 25646, Listening on 9779 ``` The Nebula Graph services consist of the Meta Service, Graph Service, and Storage Service. The configuration files for all three services are stored in the `/usr/local/nebula/etc/` directory by default. You can check the configuration files according to the return information to troubleshoot problems.