|
17 | 17 |
|
18 | 18 | package org.apache.dolphinscheduler.plugin.storage.hdfs; |
19 | 19 |
|
| 20 | +import org.apache.dolphinscheduler.common.thread.ThreadUtils; |
20 | 21 | import org.apache.dolphinscheduler.common.utils.FileUtils; |
| 22 | +import org.apache.dolphinscheduler.common.utils.PropertyUtils; |
| 23 | +import org.apache.dolphinscheduler.plugin.datasource.api.constants.DataSourceConstants; |
21 | 24 | import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; |
22 | 25 | import org.apache.dolphinscheduler.plugin.storage.api.AbstractStorageOperator; |
23 | 26 | import org.apache.dolphinscheduler.plugin.storage.api.ResourceMetadata; |
|
51 | 54 | import java.util.Date; |
52 | 55 | import java.util.LinkedList; |
53 | 56 | import java.util.List; |
| 57 | +import java.util.concurrent.TimeUnit; |
54 | 58 | import java.util.stream.Collectors; |
55 | 59 |
|
56 | 60 | import lombok.SneakyThrows; |
@@ -102,6 +106,18 @@ private void init() { |
102 | 106 |
|
103 | 107 | if (CommonUtils.getKerberosStartupState()) { |
104 | 108 | CommonUtils.loadKerberosConf(configuration); |
| 109 | + final Long kerberosExpireTimeInHour = PropertyUtils.getLong(DataSourceConstants.KERBEROS_EXPIRE_TIME, -1L); |
| 110 | + if (kerberosExpireTimeInHour > 0) { |
| 111 | + ThreadUtils.newDaemonScheduledExecutorService("ds-hdfs-kerberos-refresh-%s", 1) |
| 112 | + .scheduleWithFixedDelay(() -> { |
| 113 | + try { |
| 114 | + UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab(); |
| 115 | + log.info("checkTGTAndReloginFromKeytab finished"); |
| 116 | + } catch (Exception e) { |
| 117 | + log.error("checkTGTAndReloginFromKeytab Error", e); |
| 118 | + } |
| 119 | + }, kerberosExpireTimeInHour, kerberosExpireTimeInHour, TimeUnit.MINUTES); |
| 120 | + } |
105 | 121 | fs = FileSystem.get(configuration); |
106 | 122 | log.info("Initialize HdfsStorageOperator with kerberos"); |
107 | 123 | return; |
|
0 commit comments