Doris整合Iceberg+Spark联邦查询实战

本文档详述了如何在Hadoop 3.3、Hive 3.1.3、Doris 1.1-pr2、Spark 3.1.2和Iceberg 0.13.2环境下配置和使用Doris进行Iceberg表的联邦查询。步骤包括Hadoop、Hive、Doris和Spark的安装、配置,以及Hive元数据的初始化,最后展示了Doris如何读取Iceberg数据。

Doris整合Iceberg+Spark联邦查询实战

环境介绍:
Soft Verison
Hadoop 3.3
Hive 3.1.3
Doris 1.1-pr2
Spark 3.1.2
Iceberg 0.13.2
Hadoop HDFS 环境安装
  1. Hadoop3.3 下载

    wget https://dlcdn.apache.org/hadoop/common/hadoop-3.3.3/hadoop-3.3.3.tar.gz
    
  2. Lacalhost SSH 免密登录

      ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
      cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
      chmod 0600 ~/.ssh/authorized_keys
      ssh localhost
    

    执行 ssh localhost,会弹出安全提示,填写yes即可。

    如果是docker环境下,需要手动启动sshd服务。

     /usr/sbin/sshd
    
  3. core-site.xml配置

    [root@17a5da45700b hadoop]# cat core-site.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <!--
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License. See accompanying LICENSE file.
    -->
    
    <!-- Put site-specific property overrides in this file. -->
    
    <configuration>
        <property>
            <name>fs.defaultFS</name>
            <value>hdfs://localhost:9000</value>
        </property>
    
    <property>
      <name>hadoop.proxyuser.root.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.root.groups</name>
      <value>*</value>
    </property>
    
    </configuration>
    
  4. hdfs-site.xml配置

    [root@17a5da45700b hadoop]# cat  hdfs-site.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <!--
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License. See accompanying LICENSE file.
    -->
    
    <!-- Put site-specific property overrides in this file. -->
    
    <configuration>
        <property>
            <name>dfs.replication</name>
     
### DorisIceberg 集成及其在数据处理中的应用场景 #### DorisIceberg 的特性概述 Apache Iceberg 是一种用于大型分析型表格的数据湖表格式,能够转换表数据到分区值并维持关系的同时收集列级别的统计信息[^1]。这种设计使得 Iceberg 能够高效支持大规模数据分析操作。 StarRocks (原名Doris) 则是一个现代化的分布式SQL数据库,专为实时多维分析而构建。它提供了快速查询性能以及强大的聚合计算能力,在线性扩展性和高可用方面表现出色。 #### DorisIceberg 的集成优势 通过将 StarRocks 与 Apache Iceberg 结合起来使用,可以获得如下好处: - **高效的外部表访问**:利用 Iceberg 表结构的优势,可以更加快捷方便地读取存储于对象存储上的海量半结构化/非结构化文件作为外部表供 StarRocks 查询。 - **无缝衔接大数据生态**:由于 Iceberg 已经广泛应用于 Hadoop 生态系统之中,因此借助这一桥梁作用可以让 StarRocks 更容易接入整个大数据生态圈内的其他组件和服务。 - **增强元数据管理功能**:Iceberg 提供了一套完整的 API 来管理和维护表模式变更历史记录等功能;这些都可以被 StarRocks 所借用从而提升自身的灵活性和易用性。 #### 应用场景实例 在一个典型的大规模互联网公司日志分析平台中,可能涉及到每天数十亿条甚至更多数量级的日志事件录入工作。此时如果采用传统的关系型数据库来保存原始日志显然不太现实——不仅成本高昂而且效率低下。相反,选择基于云的对象存储服务(如 AWS S3 或阿里云 OSS)配合 Iceberg 构建起一套离线数仓架构则显得更为合理可行。而对于那些需要即时响应业务需求变化、频繁执行复杂 OLAP 类型查询请求的应用来说,则完全可以考虑引入 StarRocks 这样的高性能 MPP 数据库产品来进行加速优化处理。 ```sql CREATE EXTERNAL TABLE IF NOT EXISTS logs_iceberg ( event_time TIMESTAMP, user_id STRING, action STRING, ... ) STORED AS ICEBERG LOCATION 's3://bucket/path/to/table'; ``` 上述 SQL 创建了一个指向位于 Amazon S3 上某个特定路径下的 Iceberg 表格 `logs_iceberg` 的外部表定义语句。之后就可以像对待普通本地表一样对其进行各种 DDL/DML 操作了。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值