Setting up o3fs

Select the Ozone bucket to configure o3fs and add specific properties to core-site.xml.

  1. Select the Ozone bucket on which you want o3fs to reside.
    If you do not have a designated volume or bucket for o3fs, create them using the required commands:
    ozone sh volume create /volume
    ozone sh bucket create /volume/bucket
  2. Add the properties fs.o3fs.impl and fs.default.name to core-site.xml.
    Adding these properties makes the bucket as the default file system for HDFS dfs commands and registers the o3fs file system type.
    <property>
      <name>fs.o3fs.impl</name>
      <value>org.apache.hadoop.fs.ozone.OzoneFileSystem</value>
    </property>
    <property>
      <name>fs.defaultFS</name>
      <value>o3fs://bucket.volume.OzoneServiceId</value>
    </property>
  3. Add the ozone-filesystem-hadoop3.jar to the classpath.
    export HADOOP_CLASSPATH=/opt/ozone/share/ozonefs/lib/hadoop-ozone-filesystem-hadoop3-*.jar:$HADOOP_CLASSPATH
    After setting up o3fs, you can run hdfs commands such as the following on Ozone:
    • hdfs dfs -ls /
    • hdfs dfs -mkdir /users
    Now, applications such as Hive and Spark can run on this file system after some basic configuration changes.