public final class ConfigurationUtils extends Object
Modifier and Type | Method and Description |
---|---|
static float |
checkRatio(AlluxioConfiguration conf,
PropertyKey key)
Checks that the given property key is a ratio from 0.0 and 1.0, throwing an exception if it is
not.
|
static AlluxioProperties |
defaults()
Returns an instance of
AlluxioConfiguration with the defaults and values from
alluxio-site properties. |
static AlluxioConfiguration |
getClusterConf(GetConfigurationPResponse response,
AlluxioConfiguration conf)
Loads the cluster level configuration from the get configuration response, and merges it with
the existing configuration.
|
static List<ConfigProperty> |
getConfiguration(AlluxioConfiguration conf,
Scope scope)
Gets all configuration properties filtered by the specified scope.
|
static List<InetSocketAddress> |
getEmbeddedJournalAddresses(AlluxioConfiguration conf,
NetworkAddressUtils.ServiceType serviceType)
Gets the embedded journal addresses to use for the given service type (either master-raft or
job-master-raft).
|
static List<InetSocketAddress> |
getJobMasterEmbeddedJournalAddresses(AlluxioConfiguration conf) |
static String |
getJobMasterHostNotConfiguredMessage(String serviceName)
Returns a unified message for cases when the job master hostname cannot be determined.
|
static List<InetSocketAddress> |
getJobMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all job masters based on the configuration.
|
static List<InetSocketAddress> |
getMasterEmbeddedJournalAddresses(AlluxioConfiguration conf) |
static String |
getMasterHostNotConfiguredMessage(String serviceName)
Returns a unified message for cases when the master hostname cannot be determined.
|
static List<InetSocketAddress> |
getMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all masters based on the configuration.
|
static PathConfiguration |
getPathConf(GetConfigurationPResponse response,
AlluxioConfiguration clusterConf)
Loads the path level configuration from the get configuration response.
|
static String |
getSchemeAuthority(AlluxioConfiguration conf) |
static boolean |
isHaMode(AlluxioConfiguration conf) |
static boolean |
jobMasterHostConfigured(AlluxioConfiguration conf) |
static GetConfigurationPResponse |
loadConfiguration(InetSocketAddress address,
AlluxioConfiguration conf,
boolean ignoreClusterConf,
boolean ignorePathConf)
Loads configuration from meta master in one RPC.
|
static Properties |
loadProperties(InputStream stream) |
static Properties |
loadPropertiesFromFile(String filePath)
Loads properties from the given file.
|
static Properties |
loadPropertiesFromResource(URL resource)
Loads properties from a resource.
|
static boolean |
masterHostConfigured(AlluxioConfiguration conf) |
static AlluxioConfiguration |
merge(AlluxioConfiguration conf,
Map<?,?> properties,
Source source)
Merges the current configuration properties with new properties.
|
static void |
reloadProperties()
Reloads site properties from disk.
|
static String |
searchPropertiesFile(String propertiesFile,
String[] confPathList)
Searches the given properties file from a list of paths.
|
static String |
valueAsString(String value) |
public static List<InetSocketAddress> getEmbeddedJournalAddresses(AlluxioConfiguration conf, NetworkAddressUtils.ServiceType serviceType)
conf
- configurationserviceType
- the service to get addresses forpublic static List<InetSocketAddress> getMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
conf
- configurationpublic static List<InetSocketAddress> getJobMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
conf
- configurationpublic static List<InetSocketAddress> getMasterRpcAddresses(AlluxioConfiguration conf)
conf
- the configuration to usepublic static List<InetSocketAddress> getJobMasterRpcAddresses(AlluxioConfiguration conf)
conf
- the configuration to use@Nullable public static Properties loadPropertiesFromResource(URL resource)
resource
- url of the properties file@Nullable public static Properties loadPropertiesFromFile(String filePath)
filePath
- the absolute path of the file to load properties@Nullable public static Properties loadProperties(InputStream stream)
stream
- the stream to read properties from@Nullable public static String searchPropertiesFile(String propertiesFile, String[] confPathList)
propertiesFile
- the file to load propertiesconfPathList
- a list of paths to search the propertiesFilepublic static boolean jobMasterHostConfigured(AlluxioConfiguration conf)
conf
- the configuration to usepublic static String getMasterHostNotConfiguredMessage(String serviceName)
serviceName
- the name of the service that couldn't run. i.e. Alluxio worker, fsadmin
shell, etc.public static String getJobMasterHostNotConfiguredMessage(String serviceName)
serviceName
- the name of the service that couldn't run. i.e. Alluxio worker, fsadmin
shell, etc.public static float checkRatio(AlluxioConfiguration conf, PropertyKey key)
conf
- the configuration for looking up the property keykey
- the property keypublic static boolean masterHostConfigured(AlluxioConfiguration conf)
conf
- the configuration to usepublic static boolean isHaMode(AlluxioConfiguration conf)
conf
- the configuration usepublic static List<ConfigProperty> getConfiguration(AlluxioConfiguration conf, Scope scope)
conf
- the configuration to usescope
- the scope to filter bypublic static String valueAsString(String value)
value
- the value or null (value is not set)public static AlluxioProperties defaults()
AlluxioConfiguration
with the defaults and values from
alluxio-site properties.public static void reloadProperties()
public static AlluxioConfiguration merge(AlluxioConfiguration conf, Map<?,?> properties, Source source)
conf
- the base configurationproperties
- the source Properties
to be mergedsource
- the source of the the properties (e.g., system property, default and etc)public static GetConfigurationPResponse loadConfiguration(InetSocketAddress address, AlluxioConfiguration conf, boolean ignoreClusterConf, boolean ignorePathConf) throws AlluxioStatusException
address
- the meta master addressconf
- the existing configurationignoreClusterConf
- do not load cluster configuration related informationignorePathConf
- do not load path configuration related informationAlluxioStatusException
public static AlluxioConfiguration getClusterConf(GetConfigurationPResponse response, AlluxioConfiguration conf)
response
- the get configuration RPC responseconf
- the existing configurationpublic static PathConfiguration getPathConf(GetConfigurationPResponse response, AlluxioConfiguration clusterConf)
response
- the get configuration RPC responseclusterConf
- cluster level configurationpublic static String getSchemeAuthority(AlluxioConfiguration conf)
conf
- the configurationCopyright © 2023. All Rights Reserved.