In this page, we explain how to get your Hudi spark job to store into IBM Cloud Object Storage.

IBM COS configs

There are two configurations required for Hudi-IBM Cloud Object Storage compatibility:

  • Adding IBM COS Credentials for Hudi
  • Adding required Jars to classpath

IBM Cloud Object Storage Credentials

Simplest way to use Hudi with IBM Cloud Object Storage, is to configure your SparkSession or SparkContext with IBM Cloud Object Storage credentials using Stocator storage connector for Spark. Hudi will automatically pick this up and talk to IBM Cloud Object Storage.

Alternatively, add the required configs in your core-site.xml from where Hudi can fetch them. Replace the fs.defaultFS with your IBM Cloud Object Storage bucket name and Hudi should be able to read/write from the bucket.

For example, using HMAC keys and service name myCOS:

  1. <property>
  2. <name>fs.defaultFS</name>
  3. <value>cos://myBucket.myCOS</value>
  4. </property>
  5. <property>
  6. <name>fs.cos.flat.list</name>
  7. <value>true</value>
  8. </property>
  9. <property>
  10. <name>fs.stocator.scheme.list</name>
  11. <value>cos</value>
  12. </property>
  13. <property>
  14. <name>fs.cos.impl</name>
  15. <value>com.ibm.stocator.fs.ObjectStoreFileSystem</value>
  16. </property>
  17. <property>
  18. <name>fs.stocator.cos.impl</name>
  19. <value>com.ibm.stocator.fs.cos.COSAPIClient</value>
  20. </property>
  21. <property>
  22. <name>fs.stocator.cos.scheme</name>
  23. <value>cos</value>
  24. </property>
  25. <property>
  26. <name>fs.cos.myCos.access.key</name>
  27. <value>ACCESS KEY</value>
  28. </property>
  29. <property>
  30. <name>fs.cos.myCos.endpoint</name>
  31. <value>http://s3-api.us-geo.objectstorage.softlayer.net</value>
  32. </property>
  33. <property>
  34. <name>fs.cos.myCos.secret.key</name>
  35. <value>SECRET KEY</value>
  36. </property>

For more options see Stocator documentation.

IBM Cloud Object Storage Libs

IBM Cloud Object Storage hadoop libraries to add to our classpath

  • com.ibm.stocator:stocator:1.1.3