LinDB on GitHub
  1. Deployment
  2. 手动部署

LinDB 提供三种集群运行模式:

模式运行环境
Standalonetest/dev
集群production
多机房/Regionsproduction

Standalone

该模式把 Broker/Storage/ETCD 等组件统一集成在单进程中,以实现快速简单的部署。

适用场景:利用本地 MacOS 或者单机 Linux 环境快速部署 LinDB 测试集群,体验 LinDB 集群的基本功能。

  1. 通过 LinDB 版本发布地址 下载对应环境最新的版本;

  2. 快速启动;

只需如下命令即可使用默认配置启动 Standalone 模式进行体验,同时也可以快速生成默认配置文件并调整对应的参数,更多参数请参考

Terminal
./lind standalone run

Standalone 命令行说明:

Terminal
./lind standalone -h
Run as a standalone node with embed broker, storage, etcd)

Usage:
  lind standalone [command]

Available Commands:
  init-config create a new default standalone-config
  run         run as standalone mode

Flags:
  -h, --help   help for standalone

Use "lind standalone [command] --help" for more information about a command.
  1. 通过 http://127.0.0.1:9000 访问 LinDB Admin Console 界面来查看整体状态等,更多 Admin Console 请参考

  2. 同时也可以通过 Lin Cli 来查询状态及集群内数据,更多 Cli 请参考

集群模式

该模式需要把 LinDB 各组件进行独立部署。

适用场景:生产环境。

TIP

以下环境以部署一个最小 LinDB 集群为例子来说明集群模式的部署方式,实际业务场景请根据具体的要求来选择集群节点配置及规模。

以下示例中的 IP 仅作参考使用,请以实际 IP 为准。

本示例以 3 台主机为例,每台主机上都部署 Broker/Storage/ETCD 3 个组件,主机 IP 如下:

  • 192.168.1.10
  • 192.168.1.11
  • 192.168.1.12

组件部署顺序为 ETCD/Broker/Storage,组件信息如下:

组件配置
ETCD默认端口
默认配置
Broker默认端口
默认配置
Storage默认端口
调整各节点 ID,其他使用默认配置
  1. 部署 ETCD,具体 ETCD 安装请参考

  2. 部署 Broker,相关命令行参数如下。

Terminal
$ bin/lind broker
Run as a compute node with cluster mode enabled

Usage:
  lind broker [command]

Available Commands:
  init-config create a new default broker-config
  run         starts the broker

Flags:
  -h, --help   help for broker

Use "lind broker [command] --help" for more information about a command.
Terminal
$ lind broker init-config
  • 修改配置参数,主要修改 ETCD 地址,其他可以使用默认配置,也可以根据实际场景进行修改。
[coordinator]
## ETCD 注册 namespace
namespace = "/lindb-broker"
## ETCD 地址
endpoints = ["http://192.168.1.10:2379","http://192.168.1.11:2379","http://192.168.1.12:2379"]
.......
  • 启动 Broker。
Terminal
$ lind broker run --config=broker.toml

TIP

通常情况下,需要在 Broker 前面放一个 VIP 或者 LB 来提供统一的入口地址。

  1. 部署 Storage,相关命令行参数如下。
Terminal
$ bin/lind storage
Run as a storage node with cluster mode enabled

Usage:
  lind storage [command]

Available Commands:
  init-config create a new default storage-config
  run         starts the storage

Flags:
  -h, --help   help for storage

Use "lind storage [command] --help" for more information about a command.
Terminal
$ lind storage init-config
  • 修改配置参数,主要修改 ETCD 地址及 Storage 节点 ID,其他可以使用默认配置,也可以根据实际场景进行修改。
Terminal
[storage]
## broker 地址,用于自注册 storage 集群信息
broker-endpoint = "http://192.168.1.10:9000"
.......
[coordinator]
## ETCD 注册 namespace
namespace = "/lindb-storage"
## ETCD 地址
endpoints = ["http://192.168.1.10:2379","http://192.168.1.11:2379","http://192.168.1.12:2379"]
.......
## 自监控相关配置参数
[monitor]
## 监控指标上报地址(Broker写入地址)
url = "http://192.168.1.19:9000/api/flat/write?db=_internal"
  • 启动 Storage。
Terminal
$ lind storage run --config=storage.toml --myid=1

:::warning 需要特别注意 myid 的取值,必须确保其值在当前存储集群内是唯一的,用于标示 Storage 节点集群内的唯一性,其中 myid 的设置方式有 2 种:

  • 如上可以在启动命令中加上 --myid=1 参数该方式为设置 myid 的默认值,即在数据存储目录下是否有 myid 这个文件,如果存在该参数设置不生效,如果默认设置生效会把该值存储到 myid 文件中;
  • 通过新建或者修改数据存储目录下 myid 文件中的值;

myid 的设计思路类似 zookeeper 的 myid。 :::

  1. 通过任意一台 Broker 节点地址 http://192.168.1.10:9000 访问 LinDB Admin Console 界面来查看整体状态等,更多 Admin Console 请参考

  2. 同时也可以通过 Lin Cli 来查询状态及集群内数据,更多 Cli 请参考

多机房/Region模式

相对于集群模式,多机房/Region模式多了一个 Root 集群,用于查询汇聚各机房/Region所在集群中的数据,

下面主要介绍 Root 集群的部署。

  1. 部署 ETCD,具体 ETCD 安装请参考

  2. 部署 Root,相关命令行参数如下。

Terminal
$ bin/lind root 
Run as a root compute node with multi idc/regions mode enabled

Usage:
  lind root [command]

Available Commands:
  init-config create a new default root-config
  run         starts the root

Flags:
  -h, --help   help for root

Use "lind root [command] --help" for more information about a command.
Terminal
$ lind root init-config
  • 修改配置参数,主要修改 ETCD 地址,其他可以使用默认配置,也可以根据实际场景进行修改。
Terminal
[coordinator]
## ETCD 注册 namespace
namespace = "/lindb-root"
## ETCD 地址
endpoints = ["http://192.168.1.10:2379","http://192.168.1.11:2379","http://192.168.1.12:2379"]
.......
  • 启动 root。
Terminal
$ lind root run --config=root.toml
Previous
Kubernetes
Next
CLI