Skip to content

Commit 4d3552f

Browse files
author
yanxi0227
committed
[kerberos][去除flink-shaded依赖]
1 parent 5f8eb2b commit 4d3552f

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@
6767
</dependency>
6868

6969
<dependency>
70-
<groupId>org.apache.flink</groupId>
71-
<artifactId>flink-yarn_2.11</artifactId>
72-
<version>${flink.version}</version>
70+
<groupId>commons-codec</groupId>
71+
<artifactId>commons-codec</artifactId>
72+
<version>1.10</version>
7373
</dependency>
7474

7575
<dependency>

launcher/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,42 @@
2222
<groupId>org.apache.flink</groupId>
2323
<artifactId>flink-yarn_2.11</artifactId>
2424
<version>${flink.version}</version>
25+
<exclusions>
26+
<exclusion>
27+
<groupId>org.apache.flink</groupId>
28+
<artifactId>flink-shaded-hadoop-2</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.apache.hadoop</groupId>
35+
<artifactId>hadoop-common</artifactId>
36+
<version>${hadoop.version}</version>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.apache.hadoop</groupId>
41+
<artifactId>hadoop-hdfs</artifactId>
42+
<version>${hadoop.version}</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.apache.hadoop</groupId>
47+
<artifactId>hadoop-yarn-common</artifactId>
48+
<version>${hadoop.version}</version>
49+
</dependency>
50+
51+
<dependency>
52+
<groupId>org.apache.hadoop</groupId>
53+
<artifactId>hadoop-yarn-client</artifactId>
54+
<version>${hadoop.version}</version>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>org.apache.hadoop</groupId>
59+
<artifactId>hadoop-mapreduce-client-core</artifactId>
60+
<version>${hadoop.version}</version>
2561
</dependency>
2662

2763
<dependency>

launcher/src/main/java/com/dtstack/flink/sql/launcher/perjob/PerJobClusterClientBuilder.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void init(String yarnConfDir, Properties conf) throws IOException {
7171

7272
yarnConf = YarnConfLoader.getYarnConf(yarnConfDir);
7373

74-
if (openKerberos(conf)){
74+
if (isKerberos(conf)){
7575
String keytab = (String) conf.get(KEYTAB);
7676
String principal = (String) conf.get(PRINCIPAL);
7777
login(yarnConf, keytab, principal);
@@ -161,17 +161,19 @@ private AbstractYarnClusterDescriptor getClusterDescriptor(
161161
false);
162162
}
163163

164-
private boolean openKerberos(Properties conf){
164+
private boolean isKerberos(Properties conf){
165165
String keytab = (String) conf.get(KEYTAB);
166-
String principal = (String) conf.get(PRINCIPAL);
167-
if (StringUtils.isNotBlank(keytab) && StringUtils.isNotBlank(principal)){
166+
if (StringUtils.isNotBlank(keytab)){
168167
return true;
169168
} else {
170169
return false;
171170
}
172171
}
173172

174173
private void login(org.apache.hadoop.conf.Configuration conf, String keytab, String principal) throws IOException {
174+
if (StringUtils.isEmpty(principal)){
175+
throw new RuntimeException(PRINCIPAL + " must not be null!");
176+
}
175177
UserGroupInformation.setConfiguration(conf);
176178
UserGroupInformation.loginUserFromKeytab(principal, keytab);
177179
LOG.info("login successfully! keytab: " + keytab + "principal: " + principal);

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<properties>
3737
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3838
<flink.version>1.9.1</flink.version>
39+
<hadoop.version>2.7.3</hadoop.version>
3940
</properties>
4041

4142
<build>

0 commit comments

Comments
 (0)