You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Zhou Tianling <zh...@sensorsdata.cn> on 2022/02/19 15:36:44 UTC
What is the relationship between ranger-admin-site.xml and ranger-admin-default-site.xml?
I used to think that the hard-coded default value of ranger-admin-default-site.xml was stored in Ranger-admin-site.xml,
until today, I found that setup.sh could even modify Ranger-admin-default-site.xml.
In java code, the 2 are always used together except we explicit pass an alternative of ranger-admin-site.xml by command-line
args of EmbeddedServer::main.
How to decide which of these two files a new option/parameter should be placed in?
In RangerAdminConfig.java
private boolean addAdminResources() {
String defaultCfg = "ranger-admin-default-site.xml";
String addlCfg = "ranger-admin-site.xml";
String coreCfg = "core-site.xml";
if (!addResourceIfReadable(defaultCfg)) {}
if (!addResourceIfReadable(addlCfg)) {}
if (!addResourceIfReadable(coreCfg)){}
}
In EmbeddedServerUtil.java
private static final String CONFIG_FILE = "ranger-admin-site.xml";
private static final String CORE_SITE_CONFIG_FILENAME = "core-site.xml";
private static final String DEFAULT_CONFIG_FILENAME = "ranger-admin-default-site.xml";
private EmbeddedServerUtil() {
loadRangerConfigProperties(CONFIG_FILE);
}
public static void loadRangerConfigProperties(String configFile) {
if (CONFIG_FILE.equalsIgnoreCase(configFile)) {
XMLUtils.loadConfig(DEFAULT_CONFIG_FILENAME, rangerConfigProperties);
}
XMLUtils.loadConfig(CORE_SITE_CONFIG_FILENAME, rangerConfigProperties);
XMLUtils.loadConfig(configFile, rangerConfigProperties);
}
public static Properties getRangerConfigProperties() {
if (rangerConfigProperties.isEmpty()) {
loadRangerConfigProperties(CONFIG_FILE);
}
return rangerConfigProperties;
}
In setup.sh:
propertyName=ranger.sso.publicKey
newPropertyValue="${sso_publickey}"
updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
propertyName=ranger.keystore.file
newPropertyValue="${javax_net_ssl_keyStore}"
updatePropertyToFilePy $propertyName $newPropertyValue $to_file_default
Re: What is the relationship between ranger-admin-site.xml and ranger-admin-default-site.xml?
Posted by Zhou Tianling <zh...@sensorsdata.cn>.
Sorry, some typos
I used to think that ranger-admin-default-site.xml is the hard-coded default value of Ranger-admin-site.xml.
until today, I found that setup.sh could even modify Ranger-admin-default-site.xml.
在 2022/2/19 23:37,“Zhou Tianling”<zh...@sensorsdata.cn> 写入:
In java code, the 2 are always used together except we explicit pass an alternative of ranger-admin-site.xml by command-line
args of EmbeddedServer::main.
How to decide which of these two files a new option/parameter should be placed in?
In RangerAdminConfig.java
private boolean addAdminResources() {
String defaultCfg = "ranger-admin-default-site.xml";
String addlCfg = "ranger-admin-site.xml";
String coreCfg = "core-site.xml";
if (!addResourceIfReadable(defaultCfg)) {}
if (!addResourceIfReadable(addlCfg)) {}
if (!addResourceIfReadable(coreCfg)){}
}
In EmbeddedServerUtil.java
private static final String CONFIG_FILE = "ranger-admin-site.xml";
private static final String CORE_SITE_CONFIG_FILENAME = "core-site.xml";
private static final String DEFAULT_CONFIG_FILENAME = "ranger-admin-default-site.xml";
private EmbeddedServerUtil() {
loadRangerConfigProperties(CONFIG_FILE);
}
public static void loadRangerConfigProperties(String configFile) {
if (CONFIG_FILE.equalsIgnoreCase(configFile)) {
XMLUtils.loadConfig(DEFAULT_CONFIG_FILENAME, rangerConfigProperties);
}
XMLUtils.loadConfig(CORE_SITE_CONFIG_FILENAME, rangerConfigProperties);
XMLUtils.loadConfig(configFile, rangerConfigProperties);
}
public static Properties getRangerConfigProperties() {
if (rangerConfigProperties.isEmpty()) {
loadRangerConfigProperties(CONFIG_FILE);
}
return rangerConfigProperties;
}
In setup.sh:
propertyName=ranger.sso.publicKey
newPropertyValue="${sso_publickey}"
updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger
propertyName=ranger.keystore.file
newPropertyValue="${javax_net_ssl_keyStore}"
updatePropertyToFilePy $propertyName $newPropertyValue $to_file_default