I configure Ozone connection as follows:
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
ozoneConfiguration.addResource(new Path("/etc/hadoop/conf/ozone-site.xml"));
ozoneConfiguration.set("ozone.om.address", "ofs://ozone:9862");
OzoneClient ozClient = OzoneClientFactory.getRpcClient(ozoneConfiguration);
ObjectStore objectStore = ozClient.getObjectStore();
OzoneVolume ozoneVolume = objectStore.getVolume(VOLUME);
OzoneBucket ozoneBucket = ozoneVolume.getBucket(BUCKET);
And trying to list files:
List<OzoneFileStatus> fileStatuses = ozoneBucket.listStatus(filesDirectory, false, filesDirectory, 10000);
When filesDirectory constraint key, which also has directory type, this is work.
For example: "filesDirectory = home", and home includes folder "user". But if filesDirectory constraint key, which also has file type (for example "filesDirectory = home/user", and home/user includes file.parquet.snappy), I receive the error:
PERMISSION_DENIED
org.apache.hadoop.ozone.om.exceptions.OMException: User user@QA.DF.OCP.COM READ permission to access key Volume: data Bucket:bucket Key: /home/user
Similarly for create operations. I can create new folder in home-directory. But, when I'm trying to create new file:
ozoneBucket.createKey(fileName, fileLen)
I receive similar error:
PERMISSION_DENIED
org.apache.hadoop.ozone.om.exceptions.OMException: User user@QA.DF.OCP.COM doesn't have CREATE permission to access key Volume:data Bucket:bucket Key:file1.snappy.parquet
Ozone Client version is: hadoop-ozone-client 1.1.0
This problem is actual, when I'm only using Java API! In terminal (for example, hdfs dfs -ls ofs://ozone) everything works well! By Apache Range and terminal (-ls -R command) I see, that user has all necessary permissions.
So I suppose, that problem is located at some settings of OzoneClient in Java project. May be I need to override some properties in ozone-site.xml?
What am I doing wrong?