Git Product home page Git Product logo

nebula-console's Introduction

Nebula Graph Console

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.

Features

  • Supports interactive and non-interactive mode.
  • Supports viewing the history statements.
  • Supports autocompletion.
  • Supports multiple OS and architecture (We recommend Linux/AMD64).

How to Install

From Source Code

  1. 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.

  2. 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.

From Binary

  • 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]

Docker

Create a container:

$ docker run --rm -ti --network nebula-docker-compose_nebula-net --entrypoint=/bin/sh vesoft/nebula-console:v2-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

Export mode for Nebula Graph Console

When the export mode is enabled, Nebula Graph Console exports all the query results into a CSV file. When the export mode is disabled, the export stops. The syntax is as follows.

NOTE: The following commands are case insensitive.

  • Enable nebula-console export mode:
nebula> :set CSV <your_file.csv>
  • Disable nebula-console export mode:
nebula> :unset CSV

Load nba dataset

To load the demonstration nba dataset, make sure that Console is connected to Nebula Graph.

nebula> :play nba
Start loading dataset nba...

Load dataset succeeded!

Export .dot file

To export the graviz text to a .dot format, run the following command:

nebula> :set dot <filename>

For example:

nebula> TODO

Disconnect Nebula Graph 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.

nebula> :QUIT

Bye root!

nebula> :EXIT

Bye root!

nebula> quit

Bye root!

nebula> exit

Bye root!

Keyboard Shortcuts

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

TODO

  • CI/CD
  • batch process to reduce memory consumption and speed up IO

nebula-console's People

Contributors

jievince avatar yixinglu avatar cpwstatic avatar jude-zhu avatar aiee avatar dutor avatar amber1990zhang avatar whitewum avatar shylock-hg avatar czpmango avatar laura-ding avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.