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

Cluster deploy #56

Merged
merged 3 commits into from
Jul 7, 2020
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 @@ -101,7 +101,7 @@ rpm -ivh --prefix=${your_dir} nebula-graph-${version}.rpm
# rpm
$ rpm -qa|grep nebula
nebula-graph-1.0.0-1.x86_64
$ rmp -e nebula-graph-1.0.0-1.x86_64
$ sudo rpm -e nebula-graph-1.0.0-1.x86_64

# deb
$ dpkg -l|grep nebula
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 集群部署

在本文档中,我们将指导您使用部署 **Nebula Graph** 集群。同时我们也使用 [Docker](https://github.com/vesoft-inc/nebula-docker-compose/blob/master/README_zh-CN.md) 部署好了集群,以便您可以在几分钟之内试用。

## 前提条件

在开始部署 **Nebula Graph** 集群前,确保您已在集群的每一台机器上安装最新版本的 **Nebula Graph**。安装方式参考:

- [包安装](1.install-with-rpm-deb.md)
- [源码编译安装](../1.build/1.build-source-code.md)

由于 **Nebula Graph** 依赖较多,推荐使用安装包安装。

本文档中,我们准备了 3 台装有 CentOS 7.5 系统的机器, IP 如下:

```text
192.168.8.14 # cluster-14
192.168.8.15 # cluster-15
192.168.8.16 # cluster-16
```

## 要部署的 Nebula Graph 服务

在本文档中我们将部署以下 **Nebula Graph** 服务:

- 3 副本 `nebula-metad` 服务
- 3 副本 `nebula-storaged` 服务
- 3 副本 `nebula-graphd` 服务

```text
- cluster-14: metad/storaged/graphd
- cluster-15: metad/storaged/graphd
- cluster-16: metad/storaged/graphd
```

## 修改配置文件

**Nebula Graph** 的所有配置文件均位于 `/usr/local/nebula/etc` 目录下,并且提供了三份默认配置。

### nebula-metad.conf

部署集群时,需要根据每个节点上部署的服务修改相应配置文件中的两个参数: `local_ip``meta_server_addrs``local_ip` 要修改成节点的 IP, `meta_server_addrs` 需要修改成集群上 meta 服务的 ip:port 对。多个 ip:port 对之间需要用逗号隔开。

`cluster-14` 上的两项配置示例如下所示:

```text
# Peers
--meta_server_addrs=192.168.8.14:45500,192.168.8.15:45500,192.168.8.16:45500
# Local ip
--local_ip=192.168.8.14
# Meta daemon listening port
--port=45500
```

### nebula-graphd.conf

部署集群时,需要为 graphd 服务配置 metad 的地址和端口 `meta_server_addrs`。 cluster-14 上的部分配置如下:

```text
# Meta Server Address
--meta_server_addrs=192.168.8.14:45500,192.168.8.15:45500,192.168.8.16:45500
```

### nebula-storaged.conf

部署集群时,需要为 storaged 服务配置 metad 的地址和端口 `meta_server_addrs` 以及本机地址 `local_ip`。 cluster-14 上的部分配置如下:

```text
# Meta server address
--meta_server_addrs=192.168.8.14:45500,192.168.8.15:45500,192.168.8.16:45500
# Local ip
--local_ip=192.168.8.14
# Storage daemon listening port
--port=44500
```

## 启动集群

集群启动请参考 [启停 Nebula Graph 服务文档](2.start-stop-service.md)

## 测试集群

登录集群中的一台机器,执行如下命令:

```ngql
[(none)]> SHOW HOSTS;
==================================================================================================
| Ip | Port | Status | Leader count | Leader distribution | Partition distribution |
==================================================================================================
| 192.168.8.14 | 44500 | online | 0 | No valid partition | No valid partition |
--------------------------------------------------------------------------------------------------
| 192.168.8.15 | 44500 | online | 3 | toy: 1, test: 1, NBA: 1 | NBA: 1, toy: 1, test: 1 |
--------------------------------------------------------------------------------------------------
| 192.168.8.16 | 44500 | online | 0 | No valid partition | No valid partition |
--------------------------------------------------------------------------------------------------
| Total | | | 3 | NBA: 1, toy: 1, test: 1 | NBA: 1, test: 1, toy: 1 |
--------------------------------------------------------------------------------------------------
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
`ws_ip` | "127.0.0.1" | web service 绑定地址
`heartbeat_interval_secs` | 10 (秒) | 与 `nebula-storage.conf` 文件中的该项需一致

注意: `meta_server_addrs` 参数中推荐使用实际 IP,`127.0.0.1` 有时不会被正确解析。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • local_ip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这篇文档里面没有讲到local_ip,所以我认为没有必要在这里加


## storage 元信息持久化相关

属性名 | 默认值 | 说明 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ nebula> UPDATE CONFIGS graph:v=1;
`ws_h2_port` | 13002 | HTTP/2 协议监听端口(内部使用)
`ws_ip` | "127.0.0.1" | web service 绑定地址

注意: `meta_server_addrs` 参数中推荐使用实际 IP,`127.0.0.1` 有时不会被正确解析。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


## authorization (安全相关)

属性名 | 默认值 | 说明
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ nebula> UPDATE CONFIGS storage:v=1;
`raft_heartbeat_interval_secs` | 5 (秒) | RAFT 选举通信超时时间 | 修改配置文件重启| |
`raft_rpc_timeout_ms` | 500 (ms) | RAFT RPC 通信超时 | 修改配置文件重启| |

注意: `meta_server_addrs` 参数中推荐使用实际 IP,`127.0.0.1` 有时不会被正确解析。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


## storage 数据持久化设置

属性名 | 默认值 | 说明 |
Expand Down
2 changes: 2 additions & 0 deletions docs/manual-CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
* 安装
* [rpm 安装](3.build-develop-and-administration/2.install/1.install-with-rpm-deb.md)
* [起停服务](3.build-develop-and-administration/2.install/2.start-stop-service.md)
* [使用 Docker 安装](3.build-develop-and-administration/2.install/3.install-with-docker.md)
* [集群部署](3.build-develop-and-administration/2.install/4.cluster-deploy.md)
* 配置
* [系统要求](3.build-develop-and-administration/3.configurations/0.system-requirement.md)
* [配置持久化与优先级](3.build-develop-and-administration/3.configurations/1.config-persistency-and-priority.md)
Expand Down
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ nav:
- GO: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/go-syntax.md
- INSERT EDGE: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/insert-edge-syntax.md
- INSERT VERTEX: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/insert-vertex-syntax.md
- LOOK UP: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/lookup-syntax.md
- LOOKUP: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/lookup-syntax.md
- RETURN: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/return-syntax.md
- UPDATE EDGE: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/update-edge-syntax.md
- UPDATE VERTEX: manual-CN/2.query-language/4.statement-syntax/2.data-query-and-manipulation-statements/update-vertex-syntax.md
Expand Down Expand Up @@ -152,6 +152,7 @@ nav:
- 安装:
- rpm 安装: manual-CN/3.build-develop-and-administration/2.install/1.install-with-rpm-deb.md
- 启停服务: manual-CN/3.build-develop-and-administration/2.install/2.start-stop-service.md
- 集群部署: manual-CN/3.build-develop-and-administration/2.install/4.cluster-deploy.md
- Docker 安装: manual-CN/3.build-develop-and-administration/2.install/3.install-with-docker.md
- 配置:
- 系统要求: manual-CN/3.build-develop-and-administration/3.configurations/0.system-requirement.md
Expand Down