Set hadoop system user for client embedded in Java webapp

后端 未结 3 1715
无人及你
无人及你 2020-11-28 10:23

I would like to submit MapReduce jobs from a java web application to a remote Hadoop cluster but am unable to specify which user the job should be submitted for. I would lik

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 11:06

    Finally I stumbled on the constant

    static final String HADOOP_USER_NAME = "HADOOP_USER_NAME";`
    

    in the UserGroupInformation class.

    Setting this either as an environment variable, as a Java system property on startup (using -D) or programmatically with System.setProperty("HADOOP_USER_NAME", "hduser"); makes Hadoop use whatever username you want for connecting to the remote Hadoop cluster.

提交回复
热议问题