Step 3: Connect to NebulaGraph¶
This topic provides basic instruction on how to use the native CLI client NebulaGraph Console to connect to NebulaGraph.
When connecting to NebulaGraph for the first time, you must register the Storage Service before querying data.
NebulaGraph 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 NebulaGraph services.
- The machine on which you plan to run NebulaGraph Console has network access to the Graph Service of NebulaGraph.
The NebulaGraph Console version is compatible with the NebulaGraph version.
NebulaGraph Console and NebulaGraph of the same version number are the most compatible. There may be compatibility issues when connecting to NebulaGraph with a different version of NebulaGraph Console. The error message
incompatible version between client and serveris displayed when there is such an issue.
On the NebulaGraph Console releases page, select a NebulaGraph 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 NebulaGraph 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 NebulaGraph 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 NebulaGraph.
- 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 NebulaGraph account. Before enabling authentication, you can use any existing username. The default username is
Sets the password of your NebulaGraph account. Before enabling authentication, you can use any characters as the password.
Sets an integer-type timeout threshold of the connection. The unit is millisecond. 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 NebulaGraph.
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.