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

update swarm #93

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -4,7 +4,7 @@

## 前提条件

部署集群前,请确保所有机器已安装 Nebula Graph、Docker 和 Docker Compose。如果需要自定义负载均衡和高可用,请安装 HAProxy 和 Keepalived。
部署集群前,请确保所有机器已 Docker 和 Docker Compose。如果需要自定义负载均衡和高可用,请安装 HAProxy 和 Keepalived。
Copy link
Contributor

Choose a reason for hiding this comment

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

已安装


机器准备:

Expand Down Expand Up @@ -38,7 +38,7 @@ To add a manager to this swarm, run 'docker swarm join-token manager' and follow

### 创建集群工作节点

根据 `docker swarm init` 命令的提示内容,创建 Swarm 集群的工作节点,在机器 `192.168.1.167`、`192.168.1.168` 上分别执行以下命令
根据 `docker swarm init` 命令的提示内容,创建 Swarm 集群的工作节点,分别在机器 `192.168.1.167`、`192.168.1.168` 上执行以下命令

```bash
$ docker swarm join \
Expand Down Expand Up @@ -77,7 +77,7 @@ h1iql1uvm7123h3gon9so69dy KF2-DATA-168 Ready Active
$ vi docker-stack.yml
```

请根据您的 IP 地址与端口号进行配置。示例配置文件参考[这里](docker-stack.yml)。
请根据您的 IP 地址与端口号进行配置。示例配置文件参考 [docker-stack.yml](docker-stack.yml)。

在管理节点上执行以下命令添加 `nebula.env` 配置文件:
Amber1990Zhang marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -100,6 +100,29 @@ USER=root
$ docker stack deploy nebula -c docker-stack.yml
```

### 查看集群服务

在管理节点上执行以下命令查看服务状态:
Amber1990Zhang marked this conversation as resolved.
Show resolved Hide resolved

```bash
$ docker service ls
```

返回以下信息:

```bash
ID NAME MODE REPLICAS IMAGE PORTS
43abplqq0h2z nebula_graphd1 replicated 1/1 vesoft/nebula-graphd:nightly
jkmnyzy2772s nebula_graphd2 replicated 1/1 vesoft/nebula-graphd:nightly
uo79ebcp41uw nebula_graphd3 replicated 1/1 vesoft/nebula-graphd:nightly
p50k0l1pvth0 nebula_metad0 replicated 1/1 vesoft/nebula-metad:nightly
oafq5jph8e65 nebula_metad1 replicated 1/1 vesoft/nebula-metad:nightly
qr4t5a8u5vjv nebula_metad2 replicated 1/1 vesoft/nebula-metad:nightly
ivs5i0o69505 nebula_storaged0 replicated 1/1 vesoft/nebula-storaged:nightly
y1xlsym8q90s nebula_storaged1 replicated 1/1 vesoft/nebula-storaged:nightly
xwgu2sfi2qso nebula_storaged2 replicated 1/1 vesoft/nebula-storaged:nightly
```

## 集群负载均衡及高可用配置(可选)

目前,Nebula Graph 的客户端(1.X)未提供负载均衡,而是随机选一个 `graphd` 服务连接。因此生产使用时需自行配置负载均衡和高可用。文档中的负载均衡和高可用仅为示例方案,您可以根据需要添加其他的第三方方案。
Expand Down Expand Up @@ -157,7 +180,7 @@ defaults
timeout server 50000ms
timeout http-request 20000ms

# custom your own frontends && backends && listen conf
# customize your own frontends && backends && listen conf
#CUSTOM

listen graphd-cluster
Expand Down Expand Up @@ -195,20 +218,9 @@ apt-get update && apt-get upgrade && apt-get install keepalived -y

#### 配置 Keepalived

更改 Keepalived 配置文件 `/etc/keepalived/keepalived.conf`(三台机器中 priority 必须设置成不同值以确定优先级)。示例配置文件参考[这里](keepalived.conf)。

**注意**:配置 Keepalived 需预先准备好虚拟 IP,在以下配置中 `192.168.1.99` 即为虚拟 IP。
更改 Keepalived 配置文件 `/etc/keepalived/keepalived.conf`(三台机器中 `priority` 必须设置成不同值以确定优先级)。示例配置文件参考 [keepalived.conf](keepalived.conf)。

Keepalived 常见命令:

```bash
# 启动keepalived
systemctl start keepalived
# 使keepalived开机自启
systemctl enable keeplived
# 重启keepalived
systemctl restart keepalived
```
> **注意**:配置 Keepalived 需预先准备好虚拟 IP,在以下配置中 `192.168.1.99` 即为虚拟 IP。

## FAQ

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ vrrp_instance VI_1 {
auth_pass amber1
}
virtual_ipaddress {
# 虚拟 IP 为 192.168.1.99/24;绑定接口为 ens160;别名ens160:1,主备相同
# 虚拟 IP 为 192.168.1.99/24;绑定接口为 ens160;别名 ens160:1,主备相同
192.168.1.99/24 dev ens160 label ens160:1
}
track_script {
Expand Down Expand Up @@ -86,7 +86,7 @@ vrrp_instance VI_1 {
auth_pass amber1
}
virtual_ipaddress {
# 虚拟 IP 为 192.168.1.99/24;绑定接口为 ens160;别名ens160:1,主备相同
# 虚拟 IP 为 192.168.1.99/24;绑定接口为 ens160;别名 ens160:1,主备相同
192.168.1.99/24 dev ens160 label ens160:1
}
track_script {
Expand Down