Hadoop uses Java to set FSPERMISSION to DIR in recursive way

Hi I have a test program, load the file to hdfs user/user1/data/app/type/file.gz on this path now this test program is run multiple times by multiple users . So I want to set the file permissions to rwx so that anyone can delete this file. I have the following code

fs.setPermission(new Path("user /user1/data"),new FsPermission(FsAction.ALL,FsAction.ALL,FsAction.ALL))

The above line gives all directories drwxrwxrwx but for file.gz it gives -rw- What are the permissions of r – r–? For this reason, another user other than me cannot delete this file through the test program. I can delete the file through the test program because I have full feelings.

Please guide. I am new to Hadoop .Thanks in advance.

Using FsShell API solved my dir permission problem. It may not be the best Way, but because I am solving it for the test code it should be ok.

FsShell shell=new FsShell(conf);
try {
shell.run(new String[]{"-chmod","-R","777","user/usr1/data"});
}
catch (Exception e) {< br /> LOG.error("Couldnt change the file permissions ",e);
throw new IOException(e);
}

Hi I have a test program to load a file to hdfs user/user1/data/app/type/file.gz on this path now this test program is run multiple times by multiple users. So I want to set the file permissions to rwx so Anyone can delete this file. I have the following code

fs.setPermission(new Path("user/user1/data"),new FsPermission(FsAction. ALL,FsAction.ALL,FsAction.ALL))

The above line gives all directories drwxrwxrwx but for file.gz it gives -rw-r – r– permissions. Why? For this reason, another user other than me cannot delete this file through the test program. I can delete the file through the test program because I have full feelings.

Please guide. I am new to Hadoop Thanks in advance.

Using the FsShell API solved my dir permission problem. It may not be the best way, but because I am solving it for the test code it should No problem.

FsShell shell=new FsShell(conf);
try {
shell.run(new String[]{"- chmod","-R","777","user/usr1/data"});
}
catch (Exception e) {
LOG.error("Couldnt change the file permissions ",e);
throw new IOException(e);
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4386 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.