关注 spark技术分享,
撸spark源码 玩spark最佳实践

SparkHadoopUtil

SparkHadoopUtil

Tip

Enable DEBUG logging level for org.apache.spark.deploy.SparkHadoopUtil logger to see what happens inside.

Add the following line to conf/log4j.properties:

Refer to Logging.

Creating SparkHadoopUtil Instance — get Method

Caution
FIXME

substituteHadoopVariables Method

Caution
FIXME

transferCredentials Method

Caution
FIXME

newConfiguration Method

Caution
FIXME

conf Method

Caution
FIXME

stopCredentialUpdater Method

Caution
FIXME

Running Executable Block As Spark User — runAsSparkUser Method

runAsSparkUser runs func function with Hadoop’s UserGroupInformation of the current user as a thread local variable (and distributed to child threads). It is later used for authenticating HDFS and YARN calls.

Internally, runAsSparkUser reads the current username (as SPARK_USER environment variable or the short user name from Hadoop’s UserGroupInformation).

Caution
FIXME How to use SPARK_USER to change the current user name?

You should see the current username printed out in the following DEBUG message in the logs:

It then creates a remote user for the current user (using UserGroupInformation.createRemoteUser), transfers credential tokens and runs the input func function as the privileged user.

赞(0) 打赏
未经允许不得转载:spark技术分享 » SparkHadoopUtil
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏