Step 3: Connect to Nebula Graph¶
This topic provides basic instruction on how to use the native CLI client Nebula Console to connect to Nebula Graph.
When connecting to Nebula Graph for the first time, you must register the Storage Service before querying data.
Nebula Graph supports multiple types of clients, including a CLI client, a GUI client, and clients developed in popular programming languages. For more information, see the client list.
- You have started Nebula Graph services.
- The machine on which you plan to run Nebula Console has network access to the Graph Service of Nebula Graph.
The Nebula Console version is compatible with the Nebula Graph version.
Nebula Console and Nebula Graph of the same version number are the most compatible. There may be compatibility issues when connecting to Nebula Graph with a different version of Nebula Console. The error message
incompatible version between client and serveris displayed when there is such an issue.
On the Nebula Console releases page, select a Nebula Console version and click Assets.
It is recommended to select the latest version.
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
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.
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]
Parameter descriptions are as follows:
Shows the help menu.
Sets the IP address of the Graph 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 existing username. The default username is
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. The result will be returned and the connection stops then.
Enables SSL encryption when connecting to Nebula Graph.
Sets the storage path of the certification authority file.
Sets the storage path of the certificate file.
Sets the storage path of the private key file.
For information on more parameters, see the project repository.