GooseFS 文件系统
本页介绍如何让 Hudi 任务从腾讯云 GooseFS 读取数据以及向其写入数据。
GooseFS 是腾讯云提供的分布式缓存文件系统,位于 COS 之前作为访问入口。Hudi 能够识别其 gfs scheme,因此表可以存储在 gfs:// 路径下,与其他受支持的文件系统用法相同。
GooseFS 配置
Hudi 与 GooseFS 的兼容需要两项配置:
- 为 Hudi 添加 GooseFS 文件系统实现
- 将所需的 JAR 包加入 classpath
GooseFS 文件系统实现
在 Hudi 可以读取配置的 core-site.xml 中添加所需配置项,从而将 gfs scheme 解析到 GooseFS 客户端。
<property>
<name>fs.gfs.impl</name>
<value>com.qcloud.cos.goosefs.hadoop.FileSystem</value>
<description>The implementation class of the GooseFS Filesystem.</description>
</property>
<property>
<name>fs.AbstractFileSystem.gfs.impl</name>
<value>com.qcloud.cos.goosefs.hadoop.GooseFileSystem</value>
<description>The implementation class of the GooseFS AbstractFileSystem.</description>
</property>通过 GooseFS master 访问该表(其默认 RPC 端口为 9200),Hudi 应该就能在其中进行读写:
gfs://<goosefs-master>:9200/<path>/<to>/<table>将 fs.defaultFS 设置为 gfs:// 位置同样有效,如果你希望 GooseFS 成为作业的默认文件系统的话,但这并非必需:使用完全限定的 gfs:// 基础路径就足够了。
GooseFS 库
需要添加到 classpath 的 GooseFS 客户端库:
- com.qcloud.cos1.4.9.1
GooseFS 安装包中自带的客户端 jar ${GOOSEFS_HOME}/client/goosefs-x.x.x-client.jar 可以替代 Maven 构件使用。在 Spark 上,可通过 spark.driver.extraClassPath 和 spark.executor.extraClassPath 传递。
注意
GooseFS 未被标记为支持原子文件创建,因此 FileSystemBasedLockProvider 会在其上拒绝启动,并报错 Unsupported scheme :gfs, since this fs can not support atomic creation。若要在 GooseFS 上使用该锁提供器,请将该 scheme 添加到 hoodie.fs.atomic_creation.support 中:
hoodie.fs.atomic_creation.support=gfs其他锁提供器不受影响。
评论
登录后参与评论
KnowForge