Home

Awesome

NebulaGraph Console

This repository contains the NebulaGraph Console for NebulaGraph 3.x. NebulaGraph Console (Console for short) is a console for NebulaGraph. With Console, you can create a graph schema, import the demonstration basketballplayer dataset, and retrieve data.

Compatibility Matrix

Console versionNebulaGraph Version
v2.0.12.0.x
v2.5.02.5.x
v2.6.02.6.x
v3.0.03.x
v3.1.x3.x
v3.2.x3.x
v3.3.x3.x
v3.4.x3.x
v3.5.x3.x
v3.6.x3.x
masternightly

Features

How to Install

From Source Code

  1. Build NebulaGraph Console

    To build NebulaGraph 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 NebulaGraph Console to your host.

    $ git clone https://github.com/vesoft-inc/nebula-console
    

    Run the following command to build NebulaGraph Console.

    $ cd nebula-console
    $ make
    

    You can find a binary named nebula-console.

  2. Connect to NebulaGraph

    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]
    
    OptionDescription
    -hShows the help menu.
    -addr/-addressSets the IP/HOST address of the graphd service.
    -P/-portSets the port number of the graphd service.
    -u/-userSets the username of your NebulaGraph account. See authentication.
    -p/-passwordSets the password of your NebulaGraph account.
    -t/-timeoutSets an integer-type timeout threshold for the connection. The unit is millisecond. The default value is 120.
    -e/-evalSets a string-type nGQL statement. The nGQL statement is executed once the connection succeeds. The connection stops after the result is returned.
    -f/-fileSets 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.
    -enable_sslEnable SSL when connecting to NebulaGraph
    -ssl_root_ca_pathSets the path of the certification authority file
    -ssl_cert_pathSets the path of the certificate file
    -ssl_private_key_pathSets the path of the private key file
    -ssl_insecure_skip_verifyControls whether a client verifies the server's certificate chain and host name

    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 NebulaGraph!
    

    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.

From Binary

$ ./<$YOUR_BINARY> -addr <ip> -port <port> -u <username> -p <password>
        [-t 120] [-e "nGQL_statement" | -f filename.nGQL]

Docker

Assumed we would like to run console in docker attached to NebulaGraph's docker-compose network, which is by default nebula-docker-compose_nebula-net and we would like to use the master console version: nightly.

note: we could replace nightly with i.e. v3.0.0 for specific console version.

Option 0: we could access the container's shell with nebulagraph console installed with:

$ docker run --rm -ti --network nebula-docker-compose_nebula-net --entrypoint=/bin/sh vesoft/nebula-console:nightly

And then call it like:

docker> nebula-console -u <user> -p <password> --address=<graphd> --port=9669

Option 1: or call console directly with:

docker run --rm -ti --network nebula-net vesoft/nebula-console:nightly -addr graphd -port 9669 -u root -p nebula

Console side commands:

NOTE: The following commands are case insensitive.

nebula> :csv a.csv
nebula> :dot a.dot
nebula> PROFILE FORMAT="dot" GO FROM "player102" OVER serve YIELD dst(edge);

You can paste the content in the dot file to https://dreampuf.github.io/GraphvizOnline/ to show the execution plan.

nebula> :profile profile.log
nebula> PROFILE GO FROM "player102" OVER serve YIELD dst(edge);
nebula> :explain explain.log
nebula> EXPLAIN GO FROM "player102" OVER serve YIELD dst(edge);
nebula> :play basketballplayer
Start loading dataset basketballplayer...

Load dataset succeeded!
nebula> :repeat 3
nebula> :sleep 3

You can use :EXIT or :QUIT to disconnect from NebulaGraph. 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!

Keyboard Shortcuts

Key BindingDescription
<kbd>Ctrl-A</kbd>, <kbd>Home</kbd>Move cursor to beginning of line
<kbd>Ctrl-E</kbd>, <kbd>End</kbd>Move cursor to end of line
<kbd>Ctrl-B</kbd>, <kbd>Left</kbd>Move cursor one character left
<kbd>Ctrl-F</kbd>, <kbd>Right</kbd>Move cursor one character right
<kbd>Ctrl-Left</kbd>, <kbd>Alt-B</kbd>Move cursor to previous word
<kbd>Ctrl-Right</kbd>, <kbd>Alt-F</kbd>Move cursor to next word
<kbd>Ctrl-D</kbd>, <kbd>Del</kbd>(if line is not empty) Delete character under cursor
<kbd>Ctrl-D</kbd>(if line is empty) End of File --- quit from the console
<kbd>Ctrl-C</kbd>Reset input (create new empty prompt)
<kbd>Ctrl-L</kbd>Clear screen (line is unmodified)
<kbd>Ctrl-T</kbd>Transpose previous character with current character
<kbd>Ctrl-H</kbd>, <kbd>BackSpace</kbd>Delete character before cursor
<kbd>Ctrl-W</kbd>, <kbd>Alt-BackSpace</kbd>Delete word leading up to cursor
<kbd>Alt-D</kbd>Delete word following cursor
<kbd>Ctrl-K</kbd>Delete from cursor to end of line
<kbd>Ctrl-U</kbd>Delete from start of line to cursor
<kbd>Ctrl-P</kbd>, <kbd>Up</kbd>Previous match from history
<kbd>Ctrl-N</kbd>, <kbd>Down</kbd>Next match from history
<kbd>Ctrl-R</kbd>Reverse Search history (Ctrl-S forward, Ctrl-G cancel)
<kbd>Ctrl-Y</kbd>Paste from Yank buffer (Alt-Y to paste next yank instead)
<kbd>Tab</kbd>Next completion
<kbd>Shift-Tab</kbd>(after Tab) Previous completion

TODO