# HuaweiCloud-Hudi-plugins **Repository Path**: HuaweiCloudDeveloper/huaweicloud-hudi-plugins ## Basic Information - **Project Name**: HuaweiCloud-Hudi-plugins - **Description**: Hudi对接华为云OBS,CES,NoSql,DataArts等云服务,进行代码扩展 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-03-14 - **Last Updated**: 2025-06-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Hudi

Current English DOC | 查阅中文文档

### 项目背景 Hudi是一种数据湖的存储格式,在Hadoop文件系统之上提供了更新数据和删除数据的能力以及消费变化数据的能力。支持多种计算引擎,提供IUD接口,在 HDFS的数据集上提供了插入更新和增量拉取的流原语。 ![img](https://support.huaweicloud.com/productdesc-mrs/zh-cn_image_0000001426022834.png) 参考资料:https://support.huaweicloud.com/productdesc-mrs/mrs_08_0083.html ### 使用文档 **1.使用前准备** (1) 在华为云OBS控制台,创建一个桶,用于存放Hudi写出的数据 https://console.huaweicloud.com/console/#/obs/manager/buckets (2) 在华为云DIS控制台,创建一个通道,用于配置OBS事件通知 https://console.huaweicloud.com/dis/ 注意:在创建通道时,数据源类型需要选择 JSON ![img](https://gitee.com/HuaweiCloudDeveloper/huaweicloud-hudi-plugins/raw/master/doc/chinese_dis.png) **2.参数配置方式** 在 core-site.xml 中,配置上链接OBS所需的信息 ```xml fs.defaultFS obs://bucketname/ fs.obs.access.key Huawei Cloud access key fs.obs.secret.key Huawei Cloud secret key fs.obs.endpoint Huawei Cloud OBS endpoint to connect to fs.obs.impl org.apache.hadoop.fs.obs.OBSFileSystem ``` 在 dis.properties 中,配置上链接DIS事件通知所需的信息 ```properties endpoint=Huawei Cloud DIS endpoint to connect to region=Huawei Cloud DIS region ak=Huawei Cloud access key sk=Huawei Cloud secret key projectId=The projectId corresponding to the Huawei Cloud DIS region ``` 注意:endpoint 需要在开头加上 `https://`,例如 https://dis.cn-north-4.myhuaweicloud.com **3.运行方式** 参考 com.xnx3.obs.sources.TestDISEventSource,使用 HoodieWriterConfig 和 DISReaderConfig 对运行所需的参数进行配置 ```java HoodieWriterConfig config = new HoodieWriterConfig() .basePath("obs://hudi-test-target/hudi_dis_cow") .tableName("hudi_dis_cow") .saveMode(SaveMode.Append) .keyGenerator(NonpartitionedKeyGenerator.class.getName()) .recordkeyFieldOptKey("partitionKey") .precombineFieldOptKey("timestamp"); DISReaderConfig dicConfig = new DISReaderConfig() .streamName("hudi-dis-test") .partitionId("0") .startingSequenceNumber("0") .cursorType(PartitionCursorTypeEnum.AT_SEQUENCE_NUMBER.name()); new DISEventSource().fetchEvents(config, dicConfig); ```