Skip to content

Commit

Permalink
Merge branch 'master' into rocks-option
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 authored Nov 20, 2019
2 parents 823f35d + e4b8af7 commit 55e1104
Show file tree
Hide file tree
Showing 57 changed files with 2,082 additions and 325 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ Testing/
target/
cluster.id
pids/
.idea/
.project
.settings/
.classpath
cmake-build-debug/
.vscode/
2 changes: 2 additions & 0 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* 高可用
* 数据强一致
* 类 SQL 查询语言
* 用户鉴权
* 支持多存储后端

## 获取 `Nebula` ##

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ As a graph database, **Nebula** has these features
* Fault tolerant
* Strong data consistency
* SQL-like query language
* Role-based access control
* Support multiple storage engines

## How can I get Nebula

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.graph
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ EXPOSE 45500 45501 11000 11002
# storage ports
EXPOSE 44500 44501 12000 12002
# graph ports
EXPOSE 3369 13000 13002
EXPOSE 3699 13000 13002
2 changes: 1 addition & 1 deletion docker/Dockerfile.graphd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN rpm -ivh *.rpm \
&& mkdir -p ./{logs,data,pids} \
&& rm -rf *.rpm

EXPOSE 3369 13000 13002
EXPOSE 3699 13000 13002

ENTRYPOINT ["./bin/nebula-graphd", \
"--flagfile=./etc/nebula-graphd.conf", \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Nebula 支持的客户端

目前,Nebula 支持如下客户端:

* [Go 客户端](https://github.com/vesoft-inc/nebula-go)
* [Python 客户端](https://github.com/vesoft-inc/nebula-python)
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nebula> FETCH PROP ON player 1 YIELD player.name, player.age
nebula> FETCH PROP ON player hash(\"nebula\") YIELD player.name, player.age
-- 沿边 e1 寻找节点 1 的所有近邻,返回其姓名和年龄属性
nebula> GO FROM 1 over e1 YIELD e1._dst AS id | FETCH PROP ON player $-.id YIELD player.name, player.age
-- 与上述语句相同
-- 与上述语法相同
nebula> $var = GO FROM 1 over e1 YIELD e1._dst AS id; FETCH PROP ON player $var.id YIELD player.name, player.age
-- 获取 1,2,3 三个节点,返回姓名和年龄都不相同的记录
nebula> FETCH PROP ON player 1,2,3 YIELD DISTINCT player.name, player.age
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SHOW 语法

```ngql
SHOW {SPACES | TAGS | EDGES | HOSTS}
SHOW CONFIG [graph|meta|storage]
SHOW {SPACES | TAGS | EDGES | HOSTS | PARTS}
SHOW CONFIGS [graph|meta|storage]
```

`SHOW SPACES` 列出 Nebula Graph 集群中的所有图空间。
Expand All @@ -11,6 +11,8 @@ SHOW CONFIG [graph|meta|storage]

`SHOW HOSTS` 列出元服务器注册的所有存储主机。

`SHOW PARTS` 列出指定 SPACE 的 partition 信息。

更多关于 `SHOW CONFIGS [graph|meta|storage]` 的信息,参见 [configs syntax](../../../3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/configs-syntax.md)

## 示例
Expand All @@ -24,6 +26,34 @@ nebula> SHOW SPACES;
--------
nebula> USE test;
nebula> SHOW PARTS;
======================================================================================================
| Partition ID | Leader | Peers | Losts |
======================================================================================================
| 1 | 172.25.61.1:44600 | 172.25.61.1:44700, 172.25.61.1:44500, 172.25.61.1:44600 | |
------------------------------------------------------------------------------------------------------
| 2 | 172.25.61.1:44600 | 172.25.61.1:44500, 172.25.61.1:44600, 172.25.61.1:44700 | |
------------------------------------------------------------------------------------------------------
| 3 | 172.25.61.1:44600 | 172.25.61.1:44600, 172.25.61.1:44700, 172.25.61.1:44500 | |
------------------------------------------------------------------------------------------------------
nebula> SHOW TAGS;
=================
| ID | Name |
=================
| 2 | course |
-----------------
| 3 | building |
-----------------
| 4 | student |
-----------------
nebula> SHOW EDGES;
===============
| ID | Name |
===============
| 5 | follow |
---------------
| 6 | choose |
---------------
```
Original file line number Diff line number Diff line change
@@ -1,40 +1,63 @@
# RocksDB Compaction & Flush
# RocksDB Compaction Flush

Nebula 支持对 storage 中的 RocksDB 设置是否自动 compaction,支持通过 HTTP 请求,手动触发 storage 的 RocksDB compaction 或 flush。

## 自动 RocksDB Compaction

### 关闭自动 compaction
### 关闭自动 Compaction

在 console 输入如下命令**关闭**自动 compaction。
在 console 输入如下命令**关闭**自动 compaction 并查看更改是否生效

```bash
UPDATE CONFIGS storage:rocksdb_column_family_options = { disable_auto_compactions = true }
```ngql
nebula> UPDATE CONFIGS storage:rocksdb_column_family_options = { disable_auto_compactions = true }
nebula> GET CONFIGS storage:rocksdb_column_family_options
=========================================================================================================
| module | name | type | mode | value |
=========================================================================================================
| STORAGE | rocksdb_column_family_options | NESTED | MUTABLE | {
"disable_auto_compactions": "true"
} |
---------------------------------------------------------------------------------------------------------
```

**注意:** 可以在大批量数据写入前关闭 auto compaction,但请记得批量写入后再将其打开,长期关闭 auto compaction 会影响后续的读性能。

### 打开自动 Compaction

在 console 输入如下命令**打开**自动 compaction。
在 console 输入如下命令**打开**自动 compaction 并查看更改是否生效。Nebula 默认 compaction 为打开

```bash
UPDATE CONFIGS storage:rocksdb_column_family_options = { disable_auto_compactions = false }
```ngql
nebula> UPDATE CONFIGS storage:rocksdb_column_family_options = { disable_auto_compactions = false }
nebula> GET CONFIGS storage:rocksdb_column_family_options
==========================================================================================================
| module | name | type | mode | value |
==========================================================================================================
| STORAGE | rocksdb_column_family_options | NESTED | MUTABLE | {
"disable_auto_compactions": "false"
} |
----------------------------------------------------------------------------------------------------------
```

## 手动触发 compactionflush
## 手动触发 CompactionFlush

手动触发 compaction 和 flush 需要通过 HTTP 请求,命令如下。

```bash
curl "${ws_ip}:${ws_http_port}/admin?space=${spaceName}&${op}"
```

- `ws_ip` 为 HTTP 服务的 IP,可以在 `storage.conf` 配置文件中找到。
- `ws_ip` 为 HTTP 服务的 IP,可以在 `etc/storage.conf` 配置文件中找到。
- `ws_http_port` 为 storage 的 HTTP 服务端口。
- `op` 为相关的 admin 操作,当前只支持 `compact``flush`

例如:

```bash
curl "http://127.0.0.1:50005/admin?space=test&op=compact"
curl "http://127.0.0.1:50005/admin?space=test&op=flush"
curl "http://127.0.0.1:12000/admin?space=test&op=compact"
curl "http://127.0.0.1:12000/admin?space=test&op=flush"
```

> 注意:请先建立图空间test,再运行上面的curl命令。
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ Got 8 rows (Time spent: 5074/6488 us)

可以看到 partition 和对应的数据已均衡的分布至各个机器。

## Balance stop

`BALANCE DATA STOP` 命令用于停止已经开始执行的 balance data 计划。如果没有正在运行的 balance 计划,则会返回错误信息。如果有正在运行的 balance 计划,则会返回计划对应的 ID。

> 由于每个 balance 计划对应若干个 balance task,`BALANCE DATA STOP` 不会停止已经开始执行的 balance task,只会取消后续的 task,已经开始的 task 将继续执行直至完成。
用户可以在 `BALANCE DATA STOP` 之后输入 `BALANCE DATA $id` 来查看已经停止的 balance 计划状态。

所有已经开始执行的 task 完成后,可以再次执行 `BALANCE DATA`,重新开始 balance。

如果之前停止的计划中有失败的 task,则会继续执行之前的计划,如果之前停止的计划中所有 task 都成功了,则会新建一个 balance 计划并开始执行。

## Balance leader

`BALANCE DATA` 仅能 balance partition,但是 leader 分布仍然不均衡,这意味着旧服务过载,而新服务未得到充分使用。运行 `BALANCE LEADER` 重新分布 Raft leader:
Expand Down
10 changes: 7 additions & 3 deletions docs/manual-CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* 基本概念
* [数据模型](1.overview/1.concepts/1.data-model.md)
* [查询语言概览](1.overview/1.concepts/2.nGQL-overview.md)
* 快速开始
* 快速开始和常用链接
* [开始试用](1.overview/2.quick-start/1.get-started.md)
* [编译源代码](3.build-develop-and-administration/1.build/1.build-source-code.md)
* [部署集群](3.build-develop-and-administration/3.deploy-and-administrations/deployment/deploy-cluster.md)
* [导入 .csv 文件](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/storage-service-administration/data-import/import-csv-file.md)
* [加载 .sst 文件](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/storage-service-administration/data-import/download-and-ingest-sst-file.md)
* [Nebula 客户端](1.overview/2.quick-start/3.supported-clients.md)
* 系统设计与架构
* [设计总览](1.overview/3.design-and-architecture/1.design-and-architecture.md)
* [存储层架构](1.overview/3.design-and-architecture/2.storage-design.md)
Expand Down Expand Up @@ -69,6 +70,7 @@
* [更新点和边](2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/update-vertex-edge-syntax.md)
* [条件语句 (Where)](2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/where-syntax.md)
* [返回结果语句 (Yield)](2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/yield-syntax.md)
* [返回满足条件的语句 (Return)](2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/return-syntax.md)
* 辅助功能语句
* [Describe](2.query-language/4.statement-syntax/3.utility-statements/describe-syntax.md)
* [Use](2.query-language/4.statement-syntax/3.utility-statements/use-syntax.md)
Expand All @@ -83,16 +85,18 @@
* [使用 Docker 编译](3.build-develop-and-administration/1.build/2.build-by-docker.md)
* 源码开发和 API
* [Key Value 接口](3.build-develop-and-administration/2.develop-and-interface/kv-interfaces.md)
* [Nebula 客户端](1.overview/2.quick-start/3.supported-clients.md)

* 部署与运维
* 部署
* [用 Docker 部署](3.build-develop-and-administration/2.develop-and-interface/kv-interfaces.md)
* [用 Docker 部署](3.build-develop-and-administration/3.deploy-and-administrations/deployment/deploy-cluster-on-docker.md)
* [部署集群](3.build-develop-and-administration/1.build/2.build-by-docker.md)
* 服务器管理操作
* 账号管理
* [Drop User](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/account-management-statements/drop-user-syntax.md)
* 服务器配置
* [服务器配置](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/configs-syntax.md)
* [RocksDB Compaction & Flush](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/rocksdb-compaction-flush.md)
* [RocksDB Compaction Flush](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/rocksdb-compaction-flush.md)
* [日志](3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/log.md)
* 存储服务相关运维
* 离线数据加载
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Supported Clients by Nebula

Currently, Nebula supports the following clients:

* [Go 客户端](https://github.com/vesoft-inc/nebula-go)
* [Python 客户端](https://github.com/vesoft-inc/nebula-python)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `FETCH` syntax is used to get vertex/edge's properties.

## Fetch Vertex property

Use `FETCH PROP ON` to return a (list of) vertex's properties. Currently, you can get multiple vertices' properties with the same tag in one sentence.
Use `FETCH PROP ON` to return a (list of) vertex's properties. Currently, you can get multiple vertices' properties with the same tag in one sentence.

```ngql
FETCH PROP ON <tag_name> <vertex_id_list> [YIELD [DISTINCT] <return_list>]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Return Syntax

The `RETURN` statement is used to return the results when the filer conditions are true.

```ngql
RETURN <var_ref> IF <var_ref> IS NOT NULL
```

* <var_ref> is a variable name, e.g. `$var`.

## Examples

```ngql
nebula> $A = GO FROM 200 OVER like YIELD like._dst AS dst; \
$rA = YIELD $A.* WHERE $A.dst == 201; \
RETURN $rA IF $rA is NOT NULL; \ /* return here since $rA is not empty */
GO FROM $A.dst OVER like; /* will never be executed*/
==========
| $A.dst |
==========
| 201 |
----------
nebula> $A = GO FROM 200 OVER like YIELD like._dst AS dst; \
$rA = YIELD $A.* WHERE $A.dst == 300; \
RETURN $rA IF $rA is NOT NULL; \ /* not return since $rA is empty */
GO FROM $A.dst OVER like;
=============
| like._dst |
=============
| 200 |
-------------
| 202 |
-------------
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Show Syntax

```ngql
SHOW {SPACES | TAGS | EDGES | HOSTS}
SHOW {SPACES | TAGS | EDGES | HOSTS | PARTS}
SHOW CONFIGS [graph|meta|storage]
```

Expand All @@ -11,6 +11,8 @@ SHOW CONFIGS [graph|meta|storage]

`SHOW HOSTS` is to list storage hosts registered by the meta server. There are 6 columns: ip, port, status (online/offline), leader partitions count in all spaces, leader partitions count in each space, total partitions count in all spaces.

`SHOW PARTS` lists the partition information of the given SPACE.

For more information about `SHOW CONFIGS [graph|meta|storage]`, please refer to [configs syntax](../../../3.build-develop-and-administration/3.deploy-and-administrations/server-administration/configuration-statements/configs-syntax.md).

## Example
Expand All @@ -24,6 +26,34 @@ nebula> SHOW SPACES;
--------
nebula> USE test;
nebula> SHOW PARTS;
======================================================================================================
| Partition ID | Leader | Peers | Losts |
======================================================================================================
| 1 | 172.25.61.1:44600 | 172.25.61.1:44700, 172.25.61.1:44500, 172.25.61.1:44600 | |
------------------------------------------------------------------------------------------------------
| 2 | 172.25.61.1:44600 | 172.25.61.1:44500, 172.25.61.1:44600, 172.25.61.1:44700 | |
------------------------------------------------------------------------------------------------------
| 3 | 172.25.61.1:44600 | 172.25.61.1:44600, 172.25.61.1:44700, 172.25.61.1:44500 | |
------------------------------------------------------------------------------------------------------
nebula> SHOW TAGS;
=================
| ID | Name |
=================
| 2 | course |
-----------------
| 3 | building |
-----------------
| 4 | student |
-----------------
nebula> SHOW EDGES;
===============
| ID | Name |
===============
| 5 | follow |
---------------
| 6 | choose |
---------------
```
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@ for (const auto& result : resp.responses()) {
break;
}
}

```
Loading

0 comments on commit 55e1104

Please sign in to comment.