From 443523f9c0fcc4ba2503791090b1879c6031759b Mon Sep 17 00:00:00 2001 From: Jian He Date: Sat, 27 Jan 2018 22:18:51 -0800 Subject: [PATCH] YARN-7765. Fixed an issue that kerberos tgt not found when NM posting timeline events. Contributed by Rohith Sharma K S --- .../hadoop/yarn/server/nodemanager/NodeManager.java | 11 ++++------- .../timelineservice/NMTimelinePublisher.java | 1 + .../storage/HBaseTimelineWriterImpl.java | 5 +++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java index 5cacd20c61e..42b7b5f8ccd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java @@ -454,18 +454,15 @@ public class NodeManager extends CompositeService ((NMContext) context).setNodeStatusUpdater(nodeStatusUpdater); nmStore.setNodeStatusUpdater(nodeStatusUpdater); - super.serviceInit(conf); - // TODO add local dirs to del - } - - @Override - protected void serviceStart() throws Exception { + // Do secure login before calling init for added services. try { doSecureLogin(); } catch (IOException e) { throw new YarnRuntimeException("Failed NodeManager login", e); } - super.serviceStart(); + + super.serviceInit(conf); + // TODO add local dirs to del } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java index b8192ca9232..2ce3c5e0ef9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java @@ -100,6 +100,7 @@ public class NMTimelinePublisher extends CompositeService { this.nmLoginUGI = UserGroupInformation.isSecurityEnabled() ? UserGroupInformation.getLoginUser() : UserGroupInformation.getCurrentUser(); + LOG.info("Initialized NMTimelinePublisher UGI to " + nmLoginUGI); super.serviceInit(conf); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java index 9e9134cf3eb..f9381853f26 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java @@ -129,6 +129,11 @@ public class HBaseTimelineWriterImpl extends AbstractService implements new FlowActivityTable().getTableMutator(hbaseConf, conn); subApplicationTable = new SubApplicationTable().getTableMutator(hbaseConf, conn); + + UserGroupInformation ugi = UserGroupInformation.isSecurityEnabled() ? + UserGroupInformation.getLoginUser() : + UserGroupInformation.getCurrentUser(); + LOG.info("Initialized HBaseTimelineWriterImpl UGI to " + ugi); } /**