You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chukwa.apache.org by ey...@apache.org on 2014/07/22 19:26:08 UTC
svn commit: r1612619 - in /chukwa/trunk: CHANGES.txt
src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java
Author: eyang
Date: Tue Jul 22 17:26:07 2014
New Revision: 1612619
URL: http://svn.apache.org/r1612619
Log:
CHUKWA-719. Added Kerberos support for HBaseWriter. (Sreepathi Prasanna via Eric Yang)
Modified:
chukwa/trunk/CHANGES.txt
chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java
Modified: chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/chukwa/trunk/CHANGES.txt?rev=1612619&r1=1612618&r2=1612619&view=diff
==============================================================================
--- chukwa/trunk/CHANGES.txt (original)
+++ chukwa/trunk/CHANGES.txt Tue Jul 22 17:26:07 2014
@@ -12,6 +12,8 @@ Release 0.6 - Unreleased
NEW FEATURES
+ CHUKWA-719. Added Kerberos support for HBaseWriter. (Sreepathi Prasanna via Eric Yang)
+
CHUKWA-715. Added Oozie Adaptor for collecting Oozie metrics. (Sreepathi Prasanna via Eric Yang)
CHUKWA-712. Implemented generic REST Adaptor for fetch data from web service. (Sreepathi Prasanna via Eric Yang)
Modified: chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java
URL: http://svn.apache.org/viewvc/chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java?rev=1612619&r1=1612618&r2=1612619&view=diff
==============================================================================
--- chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java (original)
+++ chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/PipelineStageWriter.java Tue Jul 22 17:26:07 2014
@@ -19,11 +19,13 @@
package org.apache.hadoop.chukwa.datacollection.writer;
+import java.io.IOException;
import java.util.List;
import org.apache.hadoop.chukwa.Chunk;
import org.apache.hadoop.chukwa.conf.ChukwaConfiguration;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.SecurityUtil;
import org.apache.log4j.Logger;
/**
@@ -87,6 +89,13 @@ public class PipelineStageWriter impleme
lastWriter.setNextStage(stage);
lastWriter = stage;
}
+ // if authentication type is kerberos; login using the specified kerberos principal and keytab file
+ for(int i=0; i<classes.length; i++) {
+ if(classes[i].contains("HBaseWriter")) {
+ loginToKerberos (conf);
+ }
+ }
+
Class<?> stageClass = conf.getClassByName(classes[classes.length - 1]);
Object st = stageClass.newInstance();
@@ -112,5 +121,20 @@ public class PipelineStageWriter impleme
throw new WriterException("must set chukwa.pipeline");
}
}
+
+ /**
+ * If authentication type is "kerberos", this method authenticates the Chukwa agent with Kerberized HBase, using the
+ * Kerberos principal and keytab file specified in chukwa-agent-conf.xml config file.<br>
+ * Does nothing for other authentication type.
+ *
+ * @throws IOException in event of login failure
+ */
+ private static void loginToKerberos (Configuration config) throws IOException {
+ String agentAuthType = config.get ("chukwaAgent.hadoop.authentication.type");
+ if (null != agentAuthType && "kerberos".equalsIgnoreCase (agentAuthType)) {
+ SecurityUtil.login (config, "chukwaAgent.hadoop.authentication.kerberos.keytab",
+ "chukwaAgent.hadoop.authentication.kerberos.principal");
+ }
+ }
}