O3fs (Hadoop compatible)
Currently, Ozone supports two scheme: and ofs://
. The biggest difference between the o3fs
and ofs
,is that o3fs
supports operations only at a single bucket, while ofs supports operations across all volumes and buckets and provides a full view of all the volume/buckets.
To create an ozone file system, we have to choose a bucket where the file system would live. This bucket will be used as the backend store for OzoneFileSystem. All the files and directories will be stored as keys in this bucket.
Please run the following commands to create a volume and bucket, if you don’t have them already.
Once this is created, please make sure that bucket exists via the list volume or list bucket commands.
Please add the following entry to the core-site.xml.
<property>
<name>fs.AbstractFileSystem.o3fs.impl</name>
<value>org.apache.hadoop.fs.ozone.OzFs</value>
<name>fs.defaultFS</name>
<value>o3fs://bucket.volume</value>
</property>
This will make this bucket to be the default Hadoop compatible file system and register the o3fs file system type.
You also need to add the ozone-filesystem-hadoop3.jar file to the classpath:
(Note: with Hadoop 2.x, use the ozone-filesystem-hadoop2-*.jar
)
Once the default Filesystem has been setup, users can run commands like ls, put, mkdir, etc. For example,
or
Note: Bucket and volume names are not allowed to have a period in them.
Moreover, the filesystem URI can take a fully qualified form with the OM host and an optional port as a part of the path following the volume name. For example, you can specify both host and port:
hdfs dfs -ls o3fs://bucket.volume.om-host.example.com:5678/key
When the port number is not specified, it will be retrieved from config key ozone.om.address
if defined; or it will fall back to the default port 9862
. For example, we have ozone.om.address
configured as following in ozone-site.xml
:
When we run command:
hdfs dfs -ls o3fs://bucket.volume.om-host.example.com/key
The above command is essentially equivalent to:
hdfs dfs -ls o3fs://bucket.volume.om-host.example.com:6789/key