1. Doris分布式环境搭建

server/2025/1/12 21:16:35/

一. 环境准备

本次测试集群采用3台机器hadoop1、hadoop2、hadoop3, Frontend和Backend部署在同一台机器上,Frontend部署3台组成高可用,Backend部署3个节点,组成3副本存储。

主机IP操作系统FrontendBackend
hadoop1192.168.47.128Centos7FollowerBE1
hadoop2192.168.47.129Centos7FollowerBE2
hadoop3192.168.47.130Centos7FollowerBE3

1.安装JDK8,具体的安装过程这里不赘述。
2.安装mysql客户端,具体的安装过程这里不赘述。
3.关闭交换分区
在三台主机分别执行如下命令

# hadoop1关闭swap分区
[root@hadoop1 ~]# swapoff -a
# hadoop2关闭swap分区
[root@hadoop2 ~]# swapoff -a
# hadoop3关闭swap分区
[root@hadoop3 ~]# swapoff -a

4.关闭防火墙

# hadoop1关闭防火墙
[root@hadoop1 ~]# systemctl  stop firewalld
# hadoop2关闭防火墙
[root@hadoop2 ~]# systemctl  stop firewalld
# hadoop3关闭防火墙
[root@hadoop3 ~]# systemctl  stop firewalld

5.设置系统最大打开文件句柄数
三台主机都执行如下命令

vi /etc/security/limits.conf 
* soft nofile 1000000
* hard nofile 1000000

6.修改虚拟内存区域数量为

# hadoop1修改内存区域
[root@hadoop1 ~]# sysctl -w vm.max_map_count=2000000
vm.max_map_count = 2000000
# hadoop2修改内存区域
[root@hadoop2 ~]# sysctl -w vm.max_map_count=2000000
vm.max_map_count = 2000000
# hadoop3修改内存区域
[root@hadoop3 ~]# sysctl -w vm.max_map_count=2000000
vm.max_map_count = 2000000

7.关闭透明大页
三台主机都执行如下命令

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

二. 集群部署

1.下载Doris安装包,并解压

[root@hadoop1 opt]# wget https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-2.0.3-bin-x64.tar.gz
[root@hadoop1 opt]# tar xf apache-doris-2.0.3-bin-x64.tar.gz
[root@hadoop1 opt]# mv apache-doris-2.0.3-bin-x64 doris-2.0.3

2.修改配置,同步安装包到另外两台主机

# 修改FE配置
[root@hadoop1 doris-2.0.3]# vim fe/conf/fe.conf
priority_networks = 192.168.47.0/24
# 修改BE配置
[root@hadoop1 doris-2.0.3]# vim be/conf/be.conf
priority_networks = 192.168.47.0/24#将安装包同步到hadoop2和hadoop3
[root@hadoop1 opt]# scp -r doris-2.0.3/ root@hadoop2:/opt
[root@hadoop1 opt]# scp -r doris-2.0.3/ root@hadoop3:/opt

3.启动 FE Master 节点
前面集群规划时选择hadoop3作为Frontend Master节点,因此先在hadoop3启动Frontend。

[root@hadoop3 doris-2.0.3]# ./fe/bin/start_fe.sh --daemon

使用mysql客户端连接Frontend并修改root用户的密码

[root@hadoop3 doris-2.0.3]# mysql -uroot -P9030 -h hadoop3 -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>  SET PASSWORD FOR 'root' = PASSWORD('root123'); 

4.启动BE进程并注册
三台主机分别启动Backend

# hadoop1启动be
[root@hadoop1 doris-2.0.3]# ./be/bin/start_be.sh --daemon
# hadoop2启动be
[root@hadoop2 doris-2.0.3]# ./be/bin/start_be.sh --daemon
# hadoop3启动be
[root@hadoop3 doris-2.0.3]# ./be/bin/start_be.sh --daemon

三个Backend分别向hadoop3 Frontend注册

[root@hadoop3 doris-2.0.3]# mysql -uroot -P9030 -h 192.168.47.130 -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.# 三个BE分别注册
mysql> ALTER SYSTEM ADD BACKEND "192.168.47.128:9050";
Query OK, 0 rows affected (0.02 sec)mysql> ALTER SYSTEM ADD BACKEND "192.168.47.129:9050";
Query OK, 0 rows affected (0.02 sec)mysql> ALTER SYSTEM ADD BACKEND "192.168.47.130:9050";
Query OK, 0 rows affected (0.01 sec)# 查看已经注册的BE
mysql> SHOW BACKENDS;
+-----------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| BackendId | Host           | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime       | LastHeartbeat       | Alive | SystemDecommissioned | TabletNum | DataUsedCapacity | TrashUsedCapcacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | RemoteUsedCapacity | Tag                      | ErrMsg | Version                  | Status                                                                                                                        | HeartbeatFailureCounter | NodeRole |
+-----------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
| 11128     | 192.168.47.128 | 9050          | 9060   | 8040     | 8060     | 2025-01-10 00:37:03 | 2025-01-10 00:45:32 | true  | false                | 24        | 29.771 KB        | 0.000              | 24.742 GB     | 38.278 GB     | 35.36 % | 35.36 %        | 0.000              | {"location" : "default"} |        | doris-2.0.3-rc06-37d31a5 | {"lastSuccessReportTabletsTime":"2025-01-10 00:44:38","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 11129     | 192.168.47.129 | 9050          | 9060   | 8040     | 8060     | 2025-01-10 00:37:12 | 2025-01-10 00:45:32 | true  | false                | 24        | 29.771 KB        | 0.000              | 23.307 GB     | 38.278 GB     | 39.11 % | 39.11 %        | 0.000              | {"location" : "default"} |        | doris-2.0.3-rc06-37d31a5 | {"lastSuccessReportTabletsTime":"2025-01-10 00:44:40","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
| 11130     | 192.168.47.130 | 9050          | 9060   | 8040     | 8060     | 2025-01-10 00:37:35 | 2025-01-10 00:45:32 | true  | false                | 24        | 29.771 KB        | 0.000              | 23.814 GB     | 38.278 GB     | 37.79 % | 37.79 %        | 0.000              | {"location" : "default"} |        | doris-2.0.3-rc06-37d31a5 | {"lastSuccessReportTabletsTime":"2025-01-10 00:45:05","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false} | 0                       | mix      |
+-----------+----------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------+------------------+--------------------+---------------+---------------+---------+----------------+--------------------+--------------------------+--------+--------------------------+-------------------------------------------------------------------------------------------------------------------------------+-------------------------+----------+
3 rows in set (0.02 sec)

5.FE Follower注册与启动
对Hadoop1和hadoop2的Follower进行注册

[root@hadoop3 doris-2.0.3]# mysql -uroot -P9030 -h 192.168.47.130 -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.# 两个Follower分别注册
mysql> ALTER SYSTEM ADD FOLLOWER "192.168.47.128:9010";
Query OK, 0 rows affected (0.02 sec)mysql> ALTER SYSTEM ADD FOLLOWER "192.168.47.129:9010";
Query OK, 0 rows affected (0.02 sec)

启动hadoop1和haoop2上的Frontend进程,第一次启动时需要从hadoop3同步元数据。

# 同步元数据
[root@hadoop1 fe]# ./bin/start_fe.sh --helper 192.168.47.130:9010 --daemon
[root@hadoop2 fe]# ./bin/start_fe.sh --helper 192.168.47.130:9010 --daemon# 非第一次启动
[root@hadoop1 fe]# ./bin/start_fe.sh  --daemon
[root@hadoop2 fe]# ./bin/start_fe.sh  --daemon

此时可以登录到集群的web管理页面上查看集群Backend和Frontend的状态,入口地址为http://192.168.47.130:8030/login

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

6.验证集群功能
集群搭建完成后,下面进行集群功能验证。

[root@hadoop3 doris-2.0.3]# mysql -uroot -P9030 -h hadoop3 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.99 Doris version doris-2.0.3-rc06-37d31a5Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.# 创建数据库
mysql> create database testdb;
Query OK, 0 rows affected (0.01 sec)# 创建测试表
mysql> USE testdb;
Query OK, 0 rows affected (0.01 sec)
mysql> CREATE TABLE t1
(id INT,name VARCHAR(100) 
) DISTRIBUTED BY HASH(id) BUCKETS 10;# 插入数据
mysql> INSERT INTO t1 values(1, 'name1'), (2, 'name2'), (3, 'name3'), (4, 'name4');
Query OK, 4 rows affected (0.53 sec)
{'label':'insert_9a435c2107994208_b19dcc43b6a92119', 'status':'VISIBLE', 'txnId':'2004'}# 查询数据
mysql> select * from t1;
+------+-------+
| id   | name  |
+------+-------+
|    2 | name2 |
|    4 | name4 |
|    3 | name3 |
|    1 | name1 |
+------+-------+
4 rows in set (0.60 sec)

http://www.ppmy.cn/server/157850.html

相关文章

UE5 打包项目

UE5 打包项目 flyfish 通过 “文件”->“打开项目”,然后在弹出的对话框中选择项目文件(通常是以.uproject为后缀的文件) 选择目标平台: 在 UE5 主界面中,找到 “平台”(Platforms)。根据…

极狐GitLab 正式发布安全版本17.7.1、17.6.3、17.5.5

本分分享极狐GitLab 补丁版本 17.7.1, 17.6.3, 17.5.5 的详细内容。这几个版本包含重要的缺陷和安全修复代码,我们强烈建议所有私有化部署用户应该立即升级到上述的某一个版本。对于极狐GitLab SaaS,技术团队已经进行了升级,无需用户采取任何…

Windows Docker 安装

使用别人写好的软件/工具最大的障碍是什么——必然是配环境。配环境带来的折磨会极大地消解你对软件、编程本身的兴趣。虚拟机可以解决配环境的一部分问题,但它庞大笨重,且为了某个应用的环境配置好像也不值得模拟一个全新的操作系统。 Docker 的出现让…

js单例模式

保证一个类只有一个实例,并提供一个访问它的全局访问点 实现 静态方法实现 class SingleTon{//全局的访问点static getInstance(){// 保证一个类只有一个实例if(!this.instance){this.instancenew SingleTon()}return this.instance}}let aSingleTon.getInstance()let bSing…

spring task使用

Spring Task 简介 Spring Task 是 Spring 框架原生自带的任务调度框架,它犹如一把瑞士军刀,为开发者提供了丰富多样的功能,助力轻松创建和管理定时任务。相较于其他一些第三方任务调度框架,Spring Task 最大的优势在于其与 Sprin…

[豆包MarCode AI 刷题] 算法题解 Java 青训入营考核 五题打卡第三天

目录 11 中 观光景点组合得分问题 55 易 小E的射击训练 47 易 完美偶数计数 48 易 替换函数 70 易 打点计数器的区间合并 欢迎你报名豆包MarsCode 青训营-寒假专场!非常开心你加入这个充满活力和创新的大家庭。在这里,你将遇到一群和你一样对技术充…

基于springboot+vue的高校创新创业课程体系的设计与实现

开发语言:Java框架:springbootJDK版本:JDK1.8服务器:tomcat7数据库:mysql 5.7(一定要5.7版本)数据库工具:Navicat11开发软件:eclipse/myeclipse/ideaMaven包:…

如何理解机器学习中的线性模型 ?

在机器学习中,线性模型是一类重要且基础的模型,它假设目标变量(输出)是输入变量(特征)的线性组合。线性模型的核心思想是通过优化模型的参数,使模型能够捕捉输入与输出之间的线性关系。以下是线…