2

HDFS 管理者ガイドには、次のように記載されています。

「ファイルまたはディレクトリが作成されると、その所有者はクライアント プロセスのユーザー ID になり、そのグループは親ディレクトリのグループになります (BSD ルール)。」

この規則に例外はありますか? ユーザー「clientA」としてプロセスを実行していますが、別の所有者でファイルを作成する方法はありますか?

で走っていhadoop.security.authentication=simpleます。事後に呼び出すことができるようです。これsetOwnerは完全に有効なフォールバック ソリューションです。

4

2 に答える 2

1

正気に見えますか??

public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
        // TODO Auto-generated method stub

        Configuration conf = new Configuration();
        conf.addResource(new Path("/hadoop/projects/hadoop-1.0.4/conf/core-site.xml"));
        conf.addResource(new Path("/hadoop/projects/hadoop-1.0.4/conf/hdfs-site.xml"));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the directory URI...");
        String dirPath = br.readLine();
        URI uri = new URI(dirPath);
        System.out.println("Enter the user...");
        String user = br.readLine();
        FileSystem fs = FileSystem.get(uri, conf, user);
        fs.mkdirs(new Path(uri.toString()), FsPermission.getDefault());
        FSDataOutputStream fsDataOutputStream = fs.create(new Path(uri.toString()+"/file.txt"));
        fsDataOutputStream.writeBytes("This is a demo file..!!!!");
    }
于 2013-06-13T21:11:24.627 に答える