Doris 启用 HA
衡石 Doris 支持部署多个 FE、BE 节点,用户可以在多个 FE 之上部署负载均衡层来实现 Doris 的高可用,多 BE 节点可保证数据的安全性。
集群安装部署
集群部署方式默认是使用多 FE 部署,不需要额外配置
单节点安装部署
单节点部署启动 FE HA,启用 HA 的思路是通过增加新节点构建 Doris Cluster 集群实现 HA 服务
提示
Doris Cluster 集群整体节点数量需要保证为奇数台 本文示例原始部署机器为 node1,新增机器为 node2,node3,以 node2为例说明新增节点操作,node3节点操作于 node2节点操作一直,以此类推。
新增节点机器准备工作
请参考引擎新节点环境准备完成新节点准备工作。
新增节点加入已部署 Doris 集群
- 启动新增节点 FE、BE 服务
shell
$ ssh node2
hengshi@node1$ cd /opt/hengshi
hengshi@node1$ bin/hengshi-sense-bin start doris-fe single
hengshi@node1$ bin/hengshi-sense-bin start doris-be single
- 查看新增节点 FE、BE 服务启动状态
shell
$ ssh node2
hengshi@node1$ cd /opt/hengshi
hengshi@node1$ bin/hengshi-sense-bin status doris-be single
# 提示下列信息表示 BE 服务启动成功
[hengshi-sense-bin:48][ INFO ]: doris-fe status is started
hengshi@node1$ bin/hengshi-sense-bin status doris-be single
# 提示下列信息表示 BE 服务启动成功
[hengshi-sense-bin:48][ INFO ]: be status is started
- 将新增节点 FE、BE 服务增加到 doris 集群
shell
$ ssh node1
hengshi@node1$ bin/doris-client.sh
# 进入到 mysql 控制台 node2-host 为扩容节点的 ip 地址,
mysql> ALTER SYSTEM ADD FOLLOWER 'node2-host:9010';
mysql> show frontends;
# 结果 Alive 字段类型为 true,表示节点增加成功,如果结果为 false,可能需要等待几分钟后再次执行 show frontends;
+---------------------------------+--------------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
| Name | IP | EditLogPort | HttpPort | QueryPort | RpcPort | Role | IsMaster | ClusterId | Join | Alive | ReplayedJournalId | LastHeartbeat | IsHelper | ErrMsg | Version | CurrentConnected |
+---------------------------------+--------------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
| 10.10.13.125_9010_1673418419332 | node2-host | 9010 | 8030 | 9030 | 9020 | FOLLOWER | false | 633068215 | true | true | 1703188 | 2023-06-02 12:08:20 | true | | doris-1.2.1-rc01-075c88e | Yes |
+---------------------------------+--------------+-------------+----------+-----------+---------+----------+----------+-----------+------+-------+-------------------+---------------------+----------+--------+--------------------------+------------------+
# 如果反复查看结果仍然未变成 true,请联系技术人员支持。
mysql> ALTER SYSTEM ADD BACKEND 'node2-host:9050';
mysql> show backends;
# 结果 Alive 字段类型为 true,表示节点增加成功,如果结果为 false,可能需要等待几分钟后再次执行 show backends;
+-----------+-----------------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| BackendId | Cluster | IP | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime | LastHeartbeat | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | RemoteUsedCapacity | Tag | ErrMsg | Version | Status | HeartbeatFailureCounter | NodeRole |
+-----------+-----------------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| 10003 | default_cluster | node2-host | 9050 | 9060 | 8040 | 8060 | 2023-01-11 14:26:57 | 2023-06-02 10:35:03 | true | false | false | 680 | 33.526 MB | 416.611 GB | 433.784 GB | 3.96 % | 3.96 % | 0.000 | {"location" : "default"} | | doris-1.2.1-rc01-075c88e | {"lastSuccessReportTabletsTime":"2023-06-02 10:34:05","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0 | mix |
+-----------+-----------------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
# 如果反复查看结果仍然未变成 true,请联系技术人员支持。
提示
所有 新增节点加入已部署 Doris 集群 操作后执行后续操作
修改衡石配置文件,增加新增节点配置信息
shell
$ ssh node1
hengshi@node1$ cd /opt/hengshi/conf
hengshi@node1$ vi hengshi-sense-env.sh
# 修改 DORIS_FE_HOSTS 变量
export DORIS_FE_HOSTS=( `node1-host` `node2-host` `node3-host` )
# 修改 DORIS_BE_HOSTS 变量
export DORIS_BE_HOSTS=( `node1-host` `node2-host` `node3-host` )