This repository contains the Nebula Graph Console for Nebula Graph 2.0. Nebula Graph Console (Console for short) is a console for Nebula Graph. With Console, you can create a graph schema, import the demonstration nba dataset, and retrieve data.
- Supports interactive and non-interactive mode.
- Supports viewing the history statements.
- Supports autocompletion.
- Supports multiple OS and architecture (We recommend Linux/AMD64).
-
Build Nebula Graph Console
To build Nebula Graph Console, make sure that you have installed Go.
NOTE: Go version provided with apt on ubuntu is usually "outdated".
Run the following command to examine if Go is installed on your machine.
$ go version
The version should be newer than 1.13.
Use Git to clone the source code of Nebula Graph Console to your host.
$ git clone https://github.com/vesoft-inc/nebula-console
Run the following command to build Nebula Graph Console.
$ cd nebula-console $ make
You can find a binary named
nebula-console
. -
Connect to Nebula Graph
To connect to your Nebula Graph services, use the following command.
$ ./nebula-console -addr <ip> -port <port> -u <username> -p <password> [-t 120] [-e "nGQL_statement" | -f filename.nGQL]
Option Description -h
Shows the help menu. -addr/-address
Sets the IP/HOST address of the graphd service. -P/-port
Sets the port number of the graphd service. -u/-user
Sets the username of your Nebula Graph account. See authentication. -p/-password
Sets the password of your Nebula Graph account. -t/-timeout
Sets an integer-type timeout threshold for 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. You'll get the return messages and the connection stops then. E.g.,
$./nebula-console -addr=192.168.10.111 -port 9669 -u root -p nebula 2021/03/15 15:21:43 [INFO] connection pool is initialized successfully Welcome to Nebula Graph!
Check options for
./nebula-console -h
:-
try
./nebula-console
in interactive mode directly. -
And try
./nebula-console -e 'show hosts'
for the direct script mode. -
And try
./nebula-console -f demo.nGQL
for the script file mode.
-
-
Download the binaries on the Releases page
-
Add execute permissions to the binary
-
Connect to your Nebula Graph services:
$ ./<$YOUR_BINARY> -addr <ip> -port <port> -u <username> -p <password>
[-t 120] [-e "nGQL_statement" | -f filename.nGQL]
Create a container:
$ docker run --rm -ti --network nebula-docker-compose_nebula-net --entrypoint=/bin/sh vesoft/nebula-console:nightly
To connect to your Nebula Graph services, run the follow command in the container:
docker> nebula-console -u <user> -p <password> --address=<graphd> --port=9669
NOTE: The following commands are case insensitive.
- Export the result of the following statement to a csv file:
nebula> :csv a.csv
- Export the execution plan in graphviz format to a dot file when profiling a statement with format "dot" or "dot:struct":
nebula> :dot a.dot
nebula> PROFILE FORMAT="dot" GO FROM "Tony Parker" OVER like;
You can paste the content in the dot file to https://dreampuf.github.io/GraphvizOnline/
to show the execution plan.
- Load the demonstration nba dataset:
nebula> :play nba
Start loading dataset nba...
Load dataset succeeded!
- Repeat to execute a statement n times, the average execution time will also be printed:
nebula> :repeat 3
- Sleep for some seconds, it's just used in
:play nba
:
nebula> :sleep 3
- Exit the console
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
.
nebula> :QUIT
Bye root!
nebula> :EXIT
Bye root!
nebula> quit
Bye root!
nebula> exit
Bye root!
Key Binding | Description |
---|---|
Ctrl-A, Home | Move cursor to beginning of line |
Ctrl-E, End | Move cursor to end of line |
Ctrl-B, Left | Move cursor one character left |
Ctrl-F, Right | Move cursor one character right |
Ctrl-Left, Alt-B | Move cursor to previous word |
Ctrl-Right, Alt-F | Move cursor to next word |
Ctrl-D, Del | (if line is not empty) Delete character under cursor |
Ctrl-D | (if line is empty) End of File --- quit from the console |
Ctrl-C | Reset input (create new empty prompt) |
Ctrl-L | Clear screen (line is unmodified) |
Ctrl-T | Transpose previous character with current character |
Ctrl-H, BackSpace | Delete character before cursor |
Ctrl-W, Alt-BackSpace | Delete word leading up to cursor |
Alt-D | Delete word following cursor |
Ctrl-K | Delete from cursor to end of line |
Ctrl-U | Delete from start of line to cursor |
Ctrl-P, Up | Previous match from history |
Ctrl-N, Down | Next match from history |
Ctrl-R | Reverse Search history (Ctrl-S forward, Ctrl-G cancel) |
Ctrl-Y | Paste from Yank buffer (Alt-Y to paste next yank instead) |
Tab | Next completion |
Shift-Tab | (after Tab) Previous completion |
- CI/CD
- batch process to reduce memory consumption and speed up IO