Package alluxio.util
Class ConfigurationUtils
- java.lang.Object
-
- alluxio.util.ConfigurationUtils
-
public final class ConfigurationUtils extends java.lang.Object
Utilities for working with Alluxio configurations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 java.util.List<java.net.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 java.util.List<java.net.InetSocketAddress>
getJobMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
static java.lang.String
getJobMasterHostNotConfiguredMessage(java.lang.String serviceName)
Returns a unified message for cases when the job master hostname cannot be determined.static java.util.List<java.net.InetSocketAddress>
getJobMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all job masters based on the configuration.static java.util.List<java.net.InetSocketAddress>
getMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
static java.util.Set<java.lang.String>
getMasterHostnames(AlluxioConfiguration conf)
Gets list of masters in conf directory.static java.lang.String
getMasterHostNotConfiguredMessage(java.lang.String serviceName)
Returns a unified message for cases when the master hostname cannot be determined.static java.util.List<java.net.InetSocketAddress>
getMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all masters based on the configuration.static java.lang.String
getSchemeAuthority(AlluxioConfiguration conf)
static java.util.Set<java.lang.String>
getServerHostnames(AlluxioConfiguration conf)
Gets list of masters/workers in conf directory.static java.util.Set<java.lang.String>
getWorkerHostnames(AlluxioConfiguration conf)
Gets list of workers in conf directory.static boolean
isHaMode(AlluxioConfiguration conf)
static boolean
jobMasterHostConfigured(AlluxioConfiguration conf)
static boolean
masterHostConfigured(AlluxioConfiguration conf)
static java.util.List<java.lang.String>
parseAsList(java.lang.String value, java.lang.String delimiter)
Returns the input string as a list, splitting on a specified delimiter.static java.util.List<java.net.InetSocketAddress>
parseInetSocketAddresses(java.util.List<java.lang.String> addresses)
static java.lang.String
valueAsString(java.lang.String value)
-
-
-
Method Detail
-
getEmbeddedJournalAddresses
public static java.util.List<java.net.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).- Parameters:
conf
- configurationserviceType
- the service to get addresses for- Returns:
- the addresses
-
getMasterEmbeddedJournalAddresses
public static java.util.List<java.net.InetSocketAddress> getMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
- Parameters:
conf
- configuration- Returns:
- the embedded journal addresses to use for the master
-
getJobMasterEmbeddedJournalAddresses
public static java.util.List<java.net.InetSocketAddress> getJobMasterEmbeddedJournalAddresses(AlluxioConfiguration conf)
- Parameters:
conf
- configuration- Returns:
- the embedded journal addresses to use for the job master
-
getMasterRpcAddresses
public static java.util.List<java.net.InetSocketAddress> getMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all masters based on the configuration.- Parameters:
conf
- the configuration to use- Returns:
- the master rpc addresses
-
getJobMasterRpcAddresses
public static java.util.List<java.net.InetSocketAddress> getJobMasterRpcAddresses(AlluxioConfiguration conf)
Gets the RPC addresses of all job masters based on the configuration.- Parameters:
conf
- the configuration to use- Returns:
- the job master rpc addresses
-
parseInetSocketAddresses
public static java.util.List<java.net.InetSocketAddress> parseInetSocketAddresses(java.util.List<java.lang.String> addresses)
- Parameters:
addresses
- a list of address strings in the form "hostname:port"- Returns:
- a list of InetSocketAddresses representing the given address strings
-
jobMasterHostConfigured
public static boolean jobMasterHostConfigured(AlluxioConfiguration conf)
- Parameters:
conf
- the configuration to use- Returns:
- whether the configuration describes how to find the job master host, either through explicit configuration or through zookeeper
-
getMasterHostNotConfiguredMessage
public static java.lang.String getMasterHostNotConfiguredMessage(java.lang.String serviceName)
Returns a unified message for cases when the master hostname cannot be determined.- Parameters:
serviceName
- the name of the service that couldn't run. i.e. Alluxio worker, fsadmin shell, etc.- Returns:
- a string with the message
-
getJobMasterHostNotConfiguredMessage
public static java.lang.String getJobMasterHostNotConfiguredMessage(java.lang.String serviceName)
Returns a unified message for cases when the job master hostname cannot be determined.- Parameters:
serviceName
- the name of the service that couldn't run. i.e. Alluxio worker, fsadmin shell, etc.- Returns:
- a string with the message
-
checkRatio
public 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.- Parameters:
conf
- the configuration for looking up the property keykey
- the property key- Returns:
- the property value
-
masterHostConfigured
public static boolean masterHostConfigured(AlluxioConfiguration conf)
- Parameters:
conf
- the configuration to use- Returns:
- whether the configuration describes how to find the master host, either through explicit configuration or through zookeeper
-
isHaMode
public static boolean isHaMode(AlluxioConfiguration conf)
- Parameters:
conf
- the configuration use- Returns:
- whether the configuration specifies to run in ha mode
-
valueAsString
public static java.lang.String valueAsString(java.lang.String value)
- Parameters:
value
- the value or null (value is not set)- Returns:
- the value or "(no value set)" when the value is not set
-
getSchemeAuthority
public static java.lang.String getSchemeAuthority(AlluxioConfiguration conf)
- Parameters:
conf
- the configuration- Returns:
- the alluxio scheme and authority determined by the configuration
-
parseAsList
public static java.util.List<java.lang.String> parseAsList(java.lang.String value, java.lang.String delimiter)
Returns the input string as a list, splitting on a specified delimiter.- Parameters:
value
- the value to splitdelimiter
- the delimiter to split the values- Returns:
- the list of values for input string
-
getMasterHostnames
public static java.util.Set<java.lang.String> getMasterHostnames(AlluxioConfiguration conf)
Gets list of masters in conf directory.- Parameters:
conf
- configuration- Returns:
- master hostnames
-
getWorkerHostnames
public static java.util.Set<java.lang.String> getWorkerHostnames(AlluxioConfiguration conf)
Gets list of workers in conf directory.- Parameters:
conf
- configuration- Returns:
- workers hostnames
-
getServerHostnames
public static java.util.Set<java.lang.String> getServerHostnames(AlluxioConfiguration conf)
Gets list of masters/workers in conf directory.- Parameters:
conf
- configuration- Returns:
- server hostnames
-
-