public final class Configuration extends Object
Global configuration properties of Alluxio. This class works like a dictionary and serves each Alluxio configuration property as a key-value pair.
Alluxio configuration properties are loaded into this class in the following order with decreasing priority:
alluxio-env.sh
or from OS settings;alluxio-site.properties
file;
The default properties are defined in the PropertyKey
class in the codebase. Alluxio
users can override values of these default properties by creating alluxio-site.properties
and putting it under java CLASSPATH
when running Alluxio (e.g., ${ALLUXIO_HOME}/conf/)
This class defines many convenient static methods which delegate to an internal
InstancedConfiguration
. To use this global configuration in a method that takes
AlluxioConfiguration
as an argument, pass global()
.
Modifier and Type | Method and Description |
---|---|
static InstancedConfiguration |
copyGlobal() |
static AlluxioProperties |
copyProperties()
Create and return a copy of all properties.
|
static Object |
get(PropertyKey key)
Gets the value for the given key in the
Properties ; if this key is not found, a
RuntimeException is thrown. |
static Object |
get(PropertyKey key,
ConfigurationValueOptions options)
Gets the value for the given key in the
Properties ; if this key is not found, a
RuntimeException is thrown. |
static boolean |
getBoolean(PropertyKey key)
Gets the boolean representation of the value for the given key.
|
static long |
getBytes(PropertyKey key)
Gets the bytes of the value for the given key.
|
static <T> Class<T> |
getClass(PropertyKey key)
Gets the value for the given key as a class.
|
static InstancedConfiguration |
getClusterConf(GetConfigurationPResponse response,
AlluxioConfiguration conf,
Scope scope)
Loads the cluster level configuration from the get configuration response,
filters out the configuration for certain scope, and merges it with the existing configuration.
|
static List<ConfigProperty> |
getConfiguration(Scope scope)
Gets all configuration properties filtered by the specified scope.
|
static double |
getDouble(PropertyKey key)
Gets the double representation of the value for the given key.
|
static java.time.Duration |
getDuration(PropertyKey key)
Gets the time of the key as a duration.
|
static <T extends Enum<T>> |
getEnum(PropertyKey key,
Class<T> enumType)
Gets the value for the given key as an enum value.
|
static int |
getInt(PropertyKey key)
Gets the integer representation of the value for the given key.
|
static List<String> |
getList(PropertyKey key)
Gets the value for the given key as a list.
|
static long |
getLong(PropertyKey key)
Gets the long integer representation of the value for the given key.
|
static long |
getMs(PropertyKey key)
Gets the time of key in millisecond unit.
|
static Map<String,Object> |
getNestedProperties(PropertyKey prefixKey)
Gets a set of properties that share a given common prefix key as a map.
|
static Object |
getOrDefault(PropertyKey key,
String defaultValue,
ConfigurationValueOptions options) |
static <T> T |
getOrDefault(PropertyKey key,
T defaultValue) |
static PathConfiguration |
getPathConf(GetConfigurationPResponse response,
AlluxioConfiguration clusterConf)
Loads the path level configuration from the get configuration response.
|
static Source |
getSource(PropertyKey key) |
static String |
getString(PropertyKey key)
Gets the String value for the given key.
|
static AlluxioConfiguration |
global() |
static String |
hash() |
static boolean |
isSet(PropertyKey key)
Checks if the configuration contains a value for the given key.
|
static boolean |
isSetByUser(PropertyKey key)
Checks if the configuration contains a value for the given key that is set by a user.
|
static Set<PropertyKey> |
keySet() |
static void |
loadClusterDefaults(InetSocketAddress address,
Scope scope)
Loads cluster default values for workers from the meta master if it's not loaded yet.
|
static GetConfigurationPResponse |
loadConfiguration(InetSocketAddress address,
AlluxioConfiguration conf,
boolean ignoreClusterConf,
boolean ignorePathConf)
Loads configuration from meta master in one RPC.
|
static void |
merge(Map<?,?> properties,
Source source)
Merges the current configuration properties with new properties.
|
static InstancedConfiguration |
modifiableGlobal() |
static void |
reloadProperties()
Reloads site properties from disk.
|
static void |
set(PropertyKey key,
Object value)
Sets the value for the appropriate key in the
Properties . |
static void |
set(PropertyKey key,
Object value,
Source source)
Sets the value for the appropriate key in the
Properties by source. |
static Map<String,Object> |
toMap() |
static Map<String,Object> |
toMap(ConfigurationValueOptions opts) |
static void |
unset(PropertyKey key)
Unsets the value for the appropriate key in the
Properties . |
public static AlluxioProperties copyProperties()
public static void merge(Map<?,?> properties, Source source)
properties
- the source Properties
to be mergedsource
- the source of the the properties (e.g., system property, default and etc)public static void set(PropertyKey key, Object value)
Properties
.key
- the key to setvalue
- the value for the keypublic static void set(PropertyKey key, Object value, Source source)
Properties
by source.key
- the key to setvalue
- the value for the keysource
- the source of the the properties (e.g., system property, default and etc)public static void unset(PropertyKey key)
Properties
.key
- the key to unsetpublic static Object get(PropertyKey key)
Properties
; if this key is not found, a
RuntimeException is thrown.key
- the key to get the value forpublic static Object get(PropertyKey key, ConfigurationValueOptions options)
Properties
; if this key is not found, a
RuntimeException is thrown.key
- the key to get the value foroptions
- options for getting configuration valuepublic static <T> T getOrDefault(PropertyKey key, T defaultValue)
T
- the type of default valuekey
- the key to get the value fordefaultValue
- the value to return if no value is set for the specified keypublic static Object getOrDefault(PropertyKey key, String defaultValue, ConfigurationValueOptions options)
key
- the key to get the value fordefaultValue
- the value to return if no value is set for the specified keyoptions
- options for getting configuration valuepublic static boolean isSet(PropertyKey key)
key
- the key to checkpublic static boolean isSetByUser(PropertyKey key)
key
- the key to checkpublic static Set<PropertyKey> keySet()
public static String getString(PropertyKey key)
key
- the key to get the value forString
public static int getInt(PropertyKey key)
key
- the key to get the value forint
public static double getDouble(PropertyKey key)
key
- the key to get the value fordouble
public static long getLong(PropertyKey key)
key
- the key to get the value forlong
public static boolean getBoolean(PropertyKey key)
key
- the key to get the value forboolean
public static List<String> getList(PropertyKey key)
key
- the key to get the value forpublic static <T extends Enum<T>> T getEnum(PropertyKey key, Class<T> enumType)
T
- the type of the enumkey
- the key to get the value forenumType
- the type of the enumpublic static long getBytes(PropertyKey key)
key
- the key to get the value forpublic static long getMs(PropertyKey key)
key
- the key to get the value forpublic static java.time.Duration getDuration(PropertyKey key)
key
- the key to get the value forpublic static <T> Class<T> getClass(PropertyKey key)
T
- the type of the classkey
- the key to get the value forpublic static Map<String,Object> getNestedProperties(PropertyKey prefixKey)
prefixKey
- the prefix keypublic static Source getSource(PropertyKey key)
key
- the property keypublic static Map<String,Object> toMap()
public static Map<String,Object> toMap(ConfigurationValueOptions opts)
opts
- options for formatting the configuration valuespublic static AlluxioConfiguration global()
AlluxioConfiguration
API,
which is a read-only APIpublic static InstancedConfiguration modifiableGlobal()
public static InstancedConfiguration copyGlobal()
InstancedConfiguration
object based on the global configurationpublic static List<ConfigProperty> getConfiguration(Scope scope)
scope
- the scope to filter bypublic static void loadClusterDefaults(InetSocketAddress address, Scope scope) throws AlluxioStatusException
address
- the master addressscope
- the property scopeAlluxioStatusException
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 InstancedConfiguration getClusterConf(GetConfigurationPResponse response, AlluxioConfiguration conf, Scope scope)
response
- the get configuration RPC responseconf
- the existing configurationscope
- the target scopepublic static PathConfiguration getPathConf(GetConfigurationPResponse response, AlluxioConfiguration clusterConf)
response
- the get configuration RPC responseclusterConf
- cluster level configurationpublic static String hash()
public static void reloadProperties()
Copyright © 2023. All Rights Reserved.