Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Console introduction #1171

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 53 additions & 18 deletions docs-2.0/nebula-console.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,55 @@
# Nebula Console

Nebula Console is a native CLI client for Nebula Graph. It can be used to connect a Nebula Graph cluster and execute queries. It can also support special commands to manage parameters, export query results, import test datasets, etc. This topic describes these special commands.
Nebula Console is a native CLI client for Nebula Graph. It can be used to connect a Nebula Graph cluster and execute queries. It also supports special commands to manage parameters, export query results, import test datasets, etc.

To connect Nebula Graph using Nebula Console, see [Step 3: Connect to Nebula Graph](2.quick-start/3.connect-to-nebula-graph.md).
## Obtain Nebula Console

!!! note
You can obtain Nebula Console in the following ways:

- Obtain the binary file of Nebula Console from the `bin` directory in the Nebula Graph installation path.

- Download the binary file from the [GitHub releases page](https://github.com/vesoft-inc/nebula-console/releases "the nebula-console Releases page").

- Compile the source code to obtain the binary file. For more information, see [Install from source code](https://github.com/vesoft-inc/nebula-console#from-source-code).

## Nebula Console functions

### Connect to Nebula Graph

To connect to Nebula Graph with the `nebula-console` file, use the following syntax:

```bash
<path_of_console> -addr <ip> -port <port> -u <username> -p <password>
```

The commands are case insensitive.
`path_of_console` indicates the storage path of the Nebula Console binary file.

## Manage parameters
Parameter descriptions are as follows:

| Parameter | Description |
| - | - |
| `-h/-help` | Shows the help menu. |
| `-addr/-address` | Sets the IP address of the Graph service. The default address is 127.0.0.1. If Nebula Graph is deployed on [Nebula Cloud](https://docs.nebula-graph.io/2.6.2/nebula-cloud/1.what-is-cloud/), you need to create a Private Link and set the IP address of the Private Endpoint as the parameter value. |
| `-P/-port` | Sets the port number of the graphd service. The default port number is 9669. |
| `-u/-user` | Sets the username of your Nebula Graph account. Before enabling authentication, you can use any existing username. The default username is `root`. |
| `-p/-password` | Sets the password of your Nebula Graph account. Before enabling authentication, you can use any characters as the password. |
| `-t/-timeout` | Sets an integer-type timeout threshold of the connection. The unit is second. The default value is 120. |
| `-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. The result will be returned and the connection stops then. |
| `-enable_ssl` | Enables SSL encryption when connecting to Nebula Graph. |
| `-ssl_root_ca_path` | Sets the storage path of the certification authority file. |
| `-ssl_cert_path` | Sets the storage path of the certificate file. |
| `-ssl_private_key_path` | Sets the storage path of the private key file. |

For information on more parameters, see the [project repository](https://github.com/vesoft-inc/nebula-console/tree/{{console.branch}}).

For example, to connect to the Graph Service deployed on 192.168.10.8, run the following command:

```bash
./nebula-console -addr 192.168.10.8 -port 9669 -u Joe -p Joespassword
```

### Manage parameters

You can save parameters for parameterized queries.

Expand Down Expand Up @@ -58,7 +99,7 @@ You can save parameters for parameterized queries.
nebula> :param <param_name> =>;
```

## Export query results
### Export query results

Export query results, which can be saved as a CSV file or DOT file.

Expand Down Expand Up @@ -89,7 +130,7 @@ Export query results, which can be saved as a CSV file or DOT file.
nebula> PROFILE FORMAT="dot" GO FROM "player100" OVER follow;
```

## Import a testing dataset
### Import a testing dataset

The testing dataset is named `basketballplayer`. To view details about the schema and data, use the corresponding `SHOW` command.

Expand All @@ -99,7 +140,7 @@ The command to import a testing dataset is as follows:
nebula> :play basketballplayer
```

## Run a command multiple times
### Run a command multiple times

To run a command multiple times, use the following command:

Expand Down Expand Up @@ -145,15 +186,15 @@ Fri, 20 Aug 2021 06:36:05 UTC
Executed 3 times, (total time spent 3681/4734 us), (average time spent 1227/1578 us)
```

## Sleep to wait
### Sleep

This command will make Nebula Graph services sleep and wait for N seconds. The schema is altered in an async way and takes effect in the next heartbeat cycle. Therefore, this command is usually used when altering schema. The command is as follows:
This command will make Nebula Console sleep for N seconds. The schema is altered in an async way and takes effect in the next heartbeat cycle. Therefore, this command is usually used when altering schema. The command is as follows:

```ngql
nebula> :sleep N
```

## Disconnect Nebula Console from Nebula Graph
### Disconnect Nebula Console from Nebula Graph

You can use `:EXIT` or `:QUIT` to disconnect from Nebula Graph. For convenience, Nebula Console supports using these commands in lower case without the colon (":"), such as `quit`.

Expand All @@ -162,11 +203,5 @@ The example is as follows:
```ngql
nebula> :QUIT

Bye root!
Bye Joe!
```

## FAQ

### "How can I install Nebula Console from the source code?"

To download and compile the latest source code of Nebula Console, follow the instructions on [the nebula console GitHub page](https://github.com/vesoft-inc/nebula-console#build-nebula-graph-console).