Connect to Nebula Graph¶
Nebula Graph supports multiple types of clients, including a CLI client, a GUI client, and clients developed in popular programming languages. This topic provides an overview of Nebula Graph clients and basic instructions on how to use the native CLI client, Nebula Console.
Nebula Graph clients¶
You can use supported clients or console to connect to Nebula Graph.
Use Nebula Console to connect to Nebula Graph¶
- You have started the Nebula Graph services. For how to start the services, see Start and Stop Nebula Graph.
- The machine you plan to run Nebula Console on has network access to the Nebula Graph services.
On the nebula-console page, select a Nebula Console version and click Assets.
NOTE: We recommend that you select the latest release.
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.
(Optional) Rename the binary file to
NOTE: For Windows, rename the file to
On the machine to run Nebula Console, grant the execute permission of the nebula-console binary file to the user.
NOTE: For Windows, skip this step.
$ chmod 111 nebula-console
In the command line interface, change the working directory to the one where the nebula-console binary file is stored.
Run the following command to connect to Nebula Graph.
* For Linux or macOS:
$ ./nebula-console -addr <ip> -port <port> -u <username> -p <password> [-t 120] [-e "nGQL_statement" | -f filename.nGQL]
* For Windows:
> nebula-console.exe -addr <ip> -port <port> -u <username> -p <password> [-t 120] [-e "nGQL_statement" | -f filename.nGQL]
The description of the parameters is as follows.
Shows the help menu.
Sets the IP address of the graphd service. The default address is 127.0.0.1.
Sets the port number of the graphd service. The default port number is 9669.
Sets the username of your Nebula Graph account. Before enabling authentication, you can use any characters as the username.
Sets the password of your Nebula Graph account. Before enabling authentication, you can use any characters as the password.
Sets an integer-type timeout threshold of the connection. The unit is second. The default value is 120.
Sets a string-type nGQL statement. The nGQL statement is executed once the connection succeeds. The connection stops after the result is returned.
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.
Nebula Console export mode¶
When the export mode is enabled, Nebula Console exports all the query results into a CSV file. When the export mode is disabled, the export stops. The syntax is as follows.
- The following commands are case insensitive.
- The CSV file is stored in the working directory. Run the Linux command
pwdto show the working directory.
- Enable Nebula Console export mode:
nebula> :SET CSV <your_file.csv>
- Disable Nebula Console export mode:
nebula> :UNSET CSV
Disconnect Nebula Console from Nebula Graph¶
You can use
:QUIT to disconnect from Nebula Graph. For convenience, Nebula Console supports using these commands in lower case without the colon (":"), such as
nebula> :QUIT Bye root!
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.