Skip to content

Commit

Permalink
Ensure Krb auth before killing YARN apps in graceful shutdown (#9785)
Browse files Browse the repository at this point in the history
  • Loading branch information
capistrant authored Nov 16, 2020
1 parent 9e69786 commit 3447934
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ public static Path distributedClassPath(Path base)
* Dose authenticate against a secured hadoop cluster
* In case of any bug fix make sure to fix the code at HdfsStorageAuthentication#authenticate as well.
*
* @param config containing the principal name and keytab path.
*/
public static void authenticate(HadoopDruidIndexerConfig config)
public static void authenticate()
{
String principal = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getPrincipal();
String keytab = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getKeytab();
Expand Down Expand Up @@ -348,7 +347,7 @@ public static Configuration injectSystemProperties(Configuration conf, HadoopDru

public static void ensurePaths(HadoopDruidIndexerConfig config)
{
authenticate(config);
authenticate();
// config.addInputPaths() can have side-effects ( boo! :( ), so this stuff needs to be done before anything else
try {
Job job = Job.getInstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.druid.indexer.HadoopDruidIndexerJob;
import org.apache.druid.indexer.HadoopIngestionSpec;
import org.apache.druid.indexer.IngestionState;
import org.apache.druid.indexer.JobHelper;
import org.apache.druid.indexer.MetadataStorageUpdaterJobHandler;
import org.apache.druid.indexer.TaskMetricsGetter;
import org.apache.druid.indexer.TaskMetricsUtils;
Expand Down Expand Up @@ -762,6 +763,8 @@ public String[] runTask(String[] args) throws Exception
}

if (jobId != null) {
// This call to JobHelper#authenticate will be transparent if already authenticated or using inseucre Hadoop.
JobHelper.authenticate();
int res = ToolRunner.run(new JobClient(), new String[]{
"-kill",
jobId
Expand Down

0 comments on commit 3447934

Please sign in to comment.