Running Spark Streaming Jobs on a Kerberos-Enabled Cluster

本文介绍在启用Kerberos的集群上运行Spark Streaming作业的步骤,包括选择或创建用户账户、生成keytab、创建JAAS登录配置文件、添加配置设置、通过YARN本地资源分发文件,还给出了相关配置示例及在spark - submit命令中传递文件和配置选项的方法。

Use the following steps to run a Spark Streaming job on a Kerberos-enabled cluster.

  1. Select or create a user account to be used as principal.

    This should not be the kafka or spark service account.

  2. Generate a keytab for the user.
  3. Create a Java Authentication and Authorization Service (JAAS) login configuration file: for example, key.conf.
  4. Add configuration settings that specify the user keytab.

    The keytab and configuration files are distributed using YARN local resources. Because they reside in the current directory of the Spark YARN container, you should specify the location as ./v.keytab.

    The following example specifies keytab location ./v.keytab for principal vagrant@example.com:

    KafkaClient {
       com.sun.security.auth.module.Krb5LoginModule required
       useKeyTab=true
       keyTab="./v.keytab"
       storeKey=true
       useTicketCache=false
       serviceName="kafka"
       principal="vagrant@EXAMPLE.COM";
    };
  5. In your spark-submit command, pass the JAAS configuration file and keytab as local resource files, using the --filesoption, and specify the JAAS configuration file options to the JVM options specified for the driver and executor:
    spark-submit \
        --files key.conf#key.conf,v.keytab#v.keytab \
        --driver-java-options "-Djava.security.auth.login.config=./key.conf" \
        --conf "spark.executor.extraJavaOptions=-Djava.security.auth.login.config=./key.conf" \
    ...
  6. Pass any relevant Kafka security options to your streaming application.

    For example, the KafkaWordCount example accepts PLAINTEXTSASL as the last option in the command line:

    KafkaWordCount /vagrant/spark-examples.jar c6402:2181 abc ts 1 PLAINTEXTSASL

转载于:https://www.cnblogs.com/felixzh/p/10558559.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值