目录
1.Broker部署及扩缩容
1.1 BROKER 部署
1.2 BROKER 扩缩容
2. Apache Doris集群启停脚本
进入正文之前,欢迎订阅专题、对博文点赞、评论、收藏,关注IT贫道,获取高质量博客内容!
1.Broker部署及扩缩容
Broker 是 Doris 集群中一种可选进程,主要用于支持 Doris 读写远端存储上的文件和目录。建议每一个 FE 和 BE 节点都部署一个 Broker。
Broker 通过提供一个 RPC 服务端口来提供服务,是一个无状态的 Java 进程,负责为远端存储的读写操作封装一些操作,如 open,pread,pwrite 等等。除此之外,Broker 不记录任何其他信息,所以包括远端存储的连接信息、文件信息、权限信息等等,都需要通过参数在 RPC 调用中传递给 Broker 进程,才能使得 Broker 能够正确读写文件。
Broker 仅作为一个数据通路,并不参与任何计算,因此仅需占用较少的内存。通常一个 Doris 系统中会部署一个或多个 Broker 进程。并且相同类型的 Broker 会组成一个组,并设定一个 名称(Broker name)。
Broker 在 Doris 系统架构中的位置如下:
1.1 BROKER 部署
在节点划分中我们将要在node1~node5节点上部署Broker。具体操作步骤如下:
1. 准备Broker安装包
在资料中将“apache-doris-dependencies-1.2.1-bin-x86_64.tar.xz”文件进行解压,其中有“apache_hdfs_broker”文件夹,将该文件夹复制到node1~node5各个节点的 /software/doris-1.2.1目录中。
[root@node1 ~]# scp -r /software/doris-1.2.1/apache_hdfs_broker/ node2:/software/doris-1.2.1/
[root@node1 ~]# scp -r /software/doris-1.2.1/apache_hdfs_broker/ node3:/software/doris-1.2.1/
[root@node1 ~]# scp -r /software/doris-1.2.1/apache_hdfs_broker/ node4:/software/doris-1.2.1/
[root@node1 ~]# scp -r /software/doris-1.2.1/apache_hdfs_broker/ node5:/software/doris-1.2.1/
2. 启动Broker
在node1~node5节点上启动Borker:
cd /software/doris-1.2.1/apache_hdfs_broker/bin
chmod +x ./start_broker.sh
chmod +x ./stop_broker.sh
./start_broker.sh --daemon
3. 将Broker加入到Doris集群中
在node1通过mysql客户端连接Doris集群,执行SQL命令将启动的Borker加入到Doris集群中。
#通过mysql 客户端连接Doris集群
[root@node1 ~]# cd /software/mysql-5.7.22-client/bin/
[root@node1 bin]# ./mysql -uroot -P9030 -h192.168.179.4 -p123456
#将各个Broker加入到集群中
mysql> ALTER SYSTEM ADD BROKER broker_name "node1:8000","node2:8000","node3:8000","node4:8000","node5:8000";
Query OK, 0 rows affected (0.02 sec)
4. 查看broker信息
以上Broker节点加入成功后,可以通过如下SQL命令来进行查询:
# MySQL客户端查询Broker信息
mysql> SHOW PROC "/brokers";
结果如下:
同时也可以登录node1~node5任意节点的8030端口,查看broker信息,如下:
1.2 BROKER 扩缩容
Broker 实例的数量没有硬性要求。通常每台物理机部署一个即可。Broker 的添加和删除可以通过以下命令完成,这里不再演示。
ALTER SYSTEM ADD BROKER broker_name "broker_host:broker_ipc_port";
ALTER SYSTEM DROP BROKER broker_name "broker_host:broker_ipc_port";
ALTER SYSTEM DROP ALL BROKER broker_name;
Broker 是无状态的进程,可以随意启停。当然,停止后,正在其上运行的作业会失败,重试即可。
2. Apache Doris集群启停脚本
Apache Doris部署后集群中角色包括FE、BE、Broker,这些节点都可以动态扩缩容。部署集群完成后,启动集群时依次启动FE、BE、Broker即可。停止集群依次按照Broker、BE、FE停止即可。以当前搭建的5节点为例,停止集群命令如下:
#停止Broker(node1~node5节点)
cd /software/doris-1.2.1/apache_hdfs_broker/bin
./stop_broker.sh
#停止BE(node3~node5节点)
cd /software/doris-1.2.1/apache-doris-be/bin
./stop_be.sh
#停止FE(node1~node5节点)
cd /software/doris-1.2.1/apache-doris-fe/bin
./stop_fe.sh
启动集群命令如下:
#启动FE(node1~node5节点)
cd /software/doris-1.2.1/apache-doris-fe/bin
./start_fe.sh --daemon
#启动BE(node3~node5节点)
cd /software/doris-1.2.1/apache-doris-be/bin
./start_be.sh --daemon
#启动Broker(node1~node5节点)
cd /software/doris-1.2.1/apache_hdfs_broker/bin
./start_broker.sh --daemon
也可以自己写脚本来完成Doris集群的启停,将脚本存入node1节点/software/doris-1.2.1目录下,启动脚本 start_doris.sh 内容如下:
#! /bin/bash
echo -e "start apache doris cluster on node1~node5\n"
echo "start apache doris FE on node1~node5 >>>>>"
for fenode in node1 node2 node3 node4 node5
do
ssh $fenode "sh /software/doris-1.2.1/apache-doris-fe/bin/start_fe.sh --daemon"
done
sleep 2
echo -e "\n"
for fenode in node1 node2 node3 node4 node5
do
echo "***** check FE on $fenode jps *****"
ssh $fenode "jps |grep PaloFe"
done
echo -e "\n"
echo "start apache doris BE on node3~node5 >>>>>"
for benode in node3 node4 node5
do
ssh $benode "source /etc/profile;sh /software/doris-1.2.1/apache-doris-be/bin/start_be.sh --daemon"
done
sleep 2
echo -e "\n"
for benode in node3 node4 node5
do
echo "***** check BE on $benode *****"
ssh $benode "ps aux |grep doris_be"
done
echo -e "\n"
echo "start apache doris BROKER on node1~node5 >>>>>"
for brokernode in node1 node2 node3 node4 node5
do
ssh $brokernode "sh /software/doris-1.2.1/apache_hdfs_broker/bin/start_broker.sh --daemon"
done
sleep 2
echo -e "\n"
for brokernode in node1 node2 node3 node4 node5
do
echo "***** check BROKER on $brokernode jps *****"
ssh $brokernode "jps |grep BrokerBootstrap"
done
停止脚本stop_doris.sh 内容如下:
#! /bin/bash
echo -e "stop apache doris cluster on node1~node5\n"
echo "stop apache doris BROKER on node1~node5 >>>>>"
for brokernode in node1 node2 node3 node4 node5
do
ssh $brokernode "sh /software/doris-1.2.1/apache_hdfs_broker/bin/stop_broker.sh"
done
sleep 2
echo -e "\n"
for brokernode in node1 node2 node3 node4 node5
do
echo "***** check BROKER on $brokernode jps *****"
ssh $brokernode "jps |grep BrokerBootstrap"
done
echo -e "\n"
echo "stop apache doris BE on node3~node5 >>>>>"
for benode in node3 node4 node5
do
ssh $benode "source /etc/profile;sh /software/doris-1.2.1/apache-doris-be/bin/stop_be.sh"
done
sleep 2
echo -e "\n"
for benode in node3 node4 node5
do
echo "***** check BE on $benode *****"
ssh $benode "ps aux |grep doris_be"
done
echo -e "\n"
echo "stop apache doris FE on node1~node5 >>>>>"
for fenode in node1 node2 node3 node4 node5
do
ssh $fenode "sh /software/doris-1.2.1/apache-doris-fe/bin/stop_fe.sh"
done
sleep 2
echo -e "\n"
for fenode in node1 node2 node3 node4 node5
do
echo "***** check FE on $fenode jps *****"
ssh $fenode "jps |grep PaloFe"
done
启停脚本编写完成后,可以通过以下方式调用:
[root@node1 ~]# cd /software/doris-1.2.1/
[root@node1 doris-1.2.1]# sh start_doris.sh
[root@node1 doris-1.2.1]# sh stop_doris.sh