fix hdfs defaultFs not working (#11823) (#11936)

This commit is contained in:
Kerwin 2022-09-15 15:02:41 +08:00 committed by GitHub
parent 70e2db3a8c
commit 275b68992c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -73,6 +73,11 @@ public final class Constants {
public static final String FS_DEFAULT_FS = "fs.defaultFS";
/**
* hdfs defaultFS property name. Should be consistent with the property name in hdfs-site.xml
*/
public static final String HDFS_DEFAULT_FS = "fs.defaultFS";
/**
* hadoop configuration
*/

View File

@ -64,7 +64,7 @@ import static org.apache.dolphinscheduler.common.Constants.RESOURCE_TYPE_UDF;
public class HadoopUtils implements Closeable, StorageOperate {
private static final Logger logger = LoggerFactory.getLogger(HadoopUtils.class);
private String hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER);
private String hdfsUser;
public static final String RM_HA_IDS = PropertyUtils.getString(Constants.YARN_RESOURCEMANAGER_HA_RM_IDS);
public static final String APP_ADDRESS = PropertyUtils.getString(Constants.YARN_APPLICATION_STATUS_ADDRESS);
public static final String JOB_HISTORY_ADDRESS = PropertyUtils.getString(Constants.YARN_JOB_HISTORY_STATUS_ADDRESS);
@ -132,7 +132,7 @@ public class HadoopUtils implements Closeable, StorageOperate {
// the default is the local file system
if (StringUtils.isNotBlank(defaultFS)) {
Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs.");
configuration.set(Constants.FS_DEFAULT_FS, defaultFS);
configuration.set(Constants.HDFS_DEFAULT_FS, defaultFS);
fsRelatedProps.forEach((key, value) -> configuration.set(key, value));
} else {
logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULT_FS);