COS Filesystem

这个页面描述了如何让你的Hudi spark任务使用Tencent Cloud COS存储。

Tencent Cloud COS 部署

为了让Hudi使用COS,需要增加两部分的配置:

  • 为Hidi增加Tencent Cloud COS的相关配置
  • 增加Jar包的MVN依赖

Tencent Cloud COS 相关的配置

新增下面的配置到你的Hudi能访问的core-site.xml文件。使用你的COS bucket name替换掉fs.defaultFS,使用COS的key和secret分别替换fs.cosn.userinfo.secretKeyfs.cosn.userinfo.secretId。主要Hudi就能读写相应的bucket。

  1. <property>
  2. <name>fs.defaultFS</name>
  3. <value>cosn://bucketname</value>
  4. <description>COS bucket name</description>
  5. </property>
  6. <property>
  7. <name>fs.cosn.userinfo.secretId</name>
  8. <value>cos-secretId</value>
  9. <description>Tencent Cloud Secret Id</description>
  10. </property>
  11. <property>
  12. <name>fs.cosn.userinfo.secretKey</name>
  13. <value>cos-secretkey</value>
  14. <description>Tencent Cloud Secret Key</description>
  15. </property>
  16. <property>
  17. <name>fs.cosn.bucket.region</name>
  18. <value>ap-region</value>
  19. <description>The region where the bucket is located.</description>
  20. </property>
  21. <property>
  22. <name>fs.cosn.bucket.endpoint_suffix</name>
  23. <value>cos.endpoint.suffix</value>
  24. <description>
  25. COS endpoint to connect to.
  26. For public cloud users, it is recommended not to set this option, and only the correct area field is required.
  27. </description>
  28. </property>
  29. <property>
  30. <name>fs.cosn.impl</name>
  31. <value>org.apache.hadoop.fs.CosFileSystem</value>
  32. <description>The implementation class of the CosN Filesystem.</description>
  33. </property>
  34. <property>
  35. <name>fs.AbstractFileSystem.cosn.impl</name>
  36. <value>org.apache.hadoop.fs.CosN</value>
  37. <description>The implementation class of the CosN AbstractFileSystem.</description>
  38. </property>

Tencent Cloud COS Libs

添加COS依赖jar包到classpath

  • org.apache.hadoop:hadoop-cos:2.8.5