Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add console commands #888

Merged
merged 1 commit into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ Nebula Graph 采用计算存储分离架构。Graph 服务负责处理计算请

- 节约成本

计算存储分离架构能够提高资源利用率,而且可根据业务需求灵活控制成本。如果使用 [Nebula Graph Cloud](https://cloud.nebula-graph.com.cn/ "Nebula Graph Cloud official website"),可以进一步节约前期成本。
计算存储分离架构能够提高资源利用率,而且可根据业务需求灵活控制成本。

<!--如果使用 [Nebula Graph Cloud](https://cloud.nebula-graph.com.cn/ "Nebula Graph Cloud official website"),可以进一步节约前期成本。-->

- 更多可能性

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Storage服务是由nebula-storaged进程提供的,用户可以根据场景配

- Consensus层

Storage服务的中间层,实现了[Multi Group Raft](#raft协议),保证强一致性和高可用性。
Storage服务的中间层,实现了[Multi Group Raft](#multi_group_raft),保证强一致性和高可用性。

- Store Engine层

Expand Down
6 changes: 4 additions & 2 deletions docs-2.0/20.appendix/0.FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ Storage服务在毫秒级时间内多次收到插入或者更新同一点或边

报错原因通常为Graph服务向Storage服务请求了过多的数据,导致Storage服务超时。请尝试以下解决方案:

* [修改配置文件](../5.configurations-and-logs/1.configurations/3.graph-config.md): 在`nebula-graphd.conf`文件中修改`--storage_client_timeout_ms`参数的值,以增加Storage client的连接超时时间。该值的单位为毫秒(ms)。例如,设置`--storage_client_timeout_ms=60000`。如果`nebula-graphd.conf`文件中未配置该参数,请手动增加。提示:请在配置文件开头添加--local_config=true再重启服务。
* [修改配置文件](../5.configurations-and-logs/1.configurations/3.graph-config.md): 在`nebula-graphd.conf`文件中修改`--storage_client_timeout_ms`参数的值,以增加Storage client的连接超时时间。该值的单位为毫秒(ms)。例如,设置`--storage_client_timeout_ms=60000`。如果`nebula-graphd.conf`文件中未配置该参数,请手动增加。
<!--提示:请在配置文件开头添加--local_config=true再重启服务。-->
* 优化查询语句:减少全库扫描型的查询,无论是否用`LIMIT`限制了返回结果的数量;用 GO 语句改写 MATCH 语句(前者有优化,后者无优化)。
* 检查Storaged是否发生的 OOM。(`dmesg |grep nebula`)。
* 为 Storage 服务器提供性能更好的SSD或者内存。
Expand All @@ -171,7 +172,8 @@ Storage服务在毫秒级时间内多次收到插入或者更新同一点或边

- 导入数据时,手动[compaction](../8.service-tuning/compaction.md),加速读的速度。

- 增加Graph服务与Storage服务的RPC连接超时时间,在`nebula-storaged.conf`文件里面修改`--storage_client_timeout_ms`参数的值。该值的单位为毫秒(ms),默认值为60000毫秒。提示:请在配置文件开头添加--local_config=true再重启服务。
- 增加Graph服务与Storage服务的RPC连接超时时间,在`nebula-storaged.conf`文件里面修改`--storage_client_timeout_ms`参数的值。该值的单位为毫秒(ms),默认值为60000毫秒。
<!--提示:请在配置文件开头添加--local_config=true再重启服务。-->

### 如何处理`nebula-storaged.INFO`错误日志`MetaClient.cpp:65] Heartbeat failed, status:Wrong cluster!`或者 `nebula-metad.INFO`含有错误日志`HBProcessor.cpp:54] Reject wrong cluster host "x.x.x.x":9771!`

Expand Down
111 changes: 102 additions & 9 deletions docs-2.0/reuse/source_connect-to-nebula-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,124 @@ Nebula Graph支持多种类型客户端,包括CLI客户端、GUI客户端和

用户可以使用`./nebula-console --help`命令获取所有参数的说明,也可以在[项目仓库](https://github.com/vesoft-inc/nebula-console/tree/v2.0.0-ga)找到更多说明。

## Nebula Console导出模式
## Nebula Console命令

导出模式开启时,Nebula Console会导出所有请求的结果到CSV格式文件中。关闭导出模式会停止导出。使用语法如下:
Nebula Console提供部分命令,可以导出CSV文件、导出DOT文件、导入测试数据集等。

!!! note

命令不区分大小写。

### 导出CSV文件

!!! note

- CSV文件保存在当前工作目录中,即Linux命令`pwd`显示的目录。

- 命令只对下一条查询语句生效。

导出CSV文件命令如下:

```ngql
nebula> :CSV <file_name.csv>
```

### 导出DOT文件

!!! Note

- 命令不区分大小写。
- CSV格式文件保存在当前工作目录中,即Linux命令`pwd`显示的目录。
- DOT文件保存在当前工作目录中,即Linux命令`pwd`显示的目录。

- DOT文件的内容可以复制后在[GraphvizOnline](https://dreampuf.github.io/GraphvizOnline/)网页中粘贴,生成可视化的执行计划图。

- 命令只对下一条查询语句生效。

导出DOT文件命令如下:

```ngql
nebula> :dot <file_name.dot>
```

示例:

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

### 加载测试数据集

- 开启导出模式
测试数据集名称为nba,详细Schema信息和数据信息请使用相关`SHOW`命令查看。

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

```ngql
nebula> :SET CSV <your_file.csv>
nebula> :play nba
```

- 关闭导出模式
### 重复执行

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

```ngql
nebula> :UNSET CSV
nebula> :repeat N
```

## 使用Nebula Console断开连接
示例:

```ngql
nebula> :repeat 3
nebula> GO FROM "player100" OVER follow;
+-------------+
| follow._dst |
+-------------+
| "player101" |
+-------------+
| "player125" |
+-------------+
Got 2 rows (time spent 2602/3214 us)

Fri, 20 Aug 2021 06:36:05 UTC

+-------------+
| follow._dst |
+-------------+
| "player101" |
+-------------+
| "player125" |
+-------------+
Got 2 rows (time spent 583/849 us)

Fri, 20 Aug 2021 06:36:05 UTC

+-------------+
| follow._dst |
+-------------+
| "player101" |
+-------------+
| "player125" |
+-------------+
Got 2 rows (time spent 496/671 us)

Fri, 20 Aug 2021 06:36:05 UTC

Executed 3 times, (total time spent 3681/4734 us), (average time spent 1227/1578 us)
```

### 睡眠

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

```ngql
nebula> :sleep N
```

### 断开连接

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

示例:

```ngql
nebula> :QUIT

Expand Down