连接Nebula Graph服务

    用户可以使用已支持的客户端或者命令行工具来连接Nebula Graph数据库。

    • Nebula Graph服务已。

    • 运行Nebula Console的机器和运行Nebula Graph的服务器网络互通。

    操作步骤

    1. 在下载页面,确认需要的版本,单击Assets

    2. Assets区域找到机器运行所需的二进制文件,下载文件到机器上。

      Click to download the package according to your hardware architecture

    3. (可选)为方便使用,重命名文件为。

    4. 在命令行界面中,切换工作目录至nebula-console文件所在目录。

    5. 执行如下命令连接Nebula Graph。

      • Linux或macOS

        1. [-t 120] [-e "nGQL_statement" | -f filename.nGQL]
      • Windows

        1. > nebula-console.exe -addr <ip> -port <port> -u <username> -p <password>
        2. [-t 120] [-e "nGQL_statement" | -f filename.nGQL]

      参数说明如下。

    用户可以使用./nebula-console --help命令获取所有参数的说明,也可以在项目仓库找到更多说明。

    Nebula Console提供部分命令,可以导出CSV文件、导出DOT文件、导入测试数据集等。

    导出CSV文件

    导出CSV文件命令如下:

    1. nebula> :dot <file_name.dot>

    示例:

    1. nebula> :dot a.dot
    2. nebula> PROFILE FORMAT="dot" GO FROM "player100" OVER follow;

    加载测试数据集

    测试数据集名称为nba,详细Schema信息和数据信息请使用相关SHOW命令查看。

    加载测试数据集命令如下:

    重复执行

    重复执行下一个命令N次,然后打印平均执行时间。命令如下:

    1. nebula> :repeat N

    示例:

    1. nebula> GO FROM "player100" OVER follow;
    2. +-------------+
    3. | follow._dst |
    4. +-------------+
    5. | "player101" |
    6. +-------------+
    7. | "player125" |
    8. +-------------+
    9. Got 2 rows (time spent 2602/3214 us)
    10. Fri, 20 Aug 2021 06:36:05 UTC
    11. +-------------+
    12. +-------------+
    13. | "player101" |
    14. +-------------+
    15. | "player125" |
    16. +-------------+
    17. Fri, 20 Aug 2021 06:36:05 UTC
    18. +-------------+
    19. | follow._dst |
    20. +-------------+
    21. | "player101" |
    22. +-------------+
    23. | "player125" |
    24. +-------------+
    25. Got 2 rows (time spent 496/671 us)
    26. Fri, 20 Aug 2021 06:36:05 UTC
    27. Executed 3 times, (total time spent 3681/4734 us), (average time spent 1227/1578 us)

    睡眠N秒。常用于修改Schema的操作中,因为修改Schema是异步实现的,需要在下一个心跳周期才同步数据。命令如下:

    断开连接

    用户可以使用:EXIT或者:QUIT从Nebula Graph断开连接。为方便使用,Nebula Console支持使用不带冒号(:)的小写命令,例如quit

    示例:

    1. nebula> :QUIT
    2. Bye root!

    如何通过源码安装Nebula Console?