Package org.apache.hadoop.hbase
Class HBaseConfiguration
java.lang.Object
org.apache.hadoop.conf.Configuration
org.apache.hadoop.hbase.HBaseConfiguration
Adds HBase configuration files to a Configuration
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.conf.Configuration
org.apache.hadoop.conf.Configuration.DeprecationDelta, org.apache.hadoop.conf.Configuration.IntegerRanges
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDeprecated.since 0.90.0.HBaseConfiguration
(org.apache.hadoop.conf.Configuration c) Deprecated.since 0.90.0. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by hbase.server.allocator.max.buffer.count and hbase.server.allocator.buffer.size.static org.apache.hadoop.conf.Configuration
addHbaseResources
(org.apache.hadoop.conf.Configuration conf) private static void
applyClusterKeyToConf
(org.apache.hadoop.conf.Configuration conf, String key) Apply the settings in the given key to the given configuration, this is used to communicate with distant clustersprivate static void
checkDefaultsVersion
(org.apache.hadoop.conf.Configuration conf) static org.apache.hadoop.conf.Configuration
create()
Creates a Configuration with HBase resourcesstatic org.apache.hadoop.conf.Configuration
create
(org.apache.hadoop.conf.Configuration that) Creates a Configuration with HBase resourcesstatic org.apache.hadoop.conf.Configuration
createClusterConf
(org.apache.hadoop.conf.Configuration baseConf, String clusterKey) Generates aConfiguration
instance by applying the ZooKeeper cluster key to the base Configuration.static org.apache.hadoop.conf.Configuration
createClusterConf
(org.apache.hadoop.conf.Configuration baseConf, String clusterKey, String overridePrefix) Generates aConfiguration
instance by applying property overrides prefixed by a cluster profile key to the base Configuration.static int
getInt
(org.apache.hadoop.conf.Configuration conf, String name, String deprecatedName, int defaultValue) Deprecated.it will be removed in 3.0.0.static String
getPassword
(org.apache.hadoop.conf.Configuration conf, String alias, String defPass) Get the password from the Configuration instance using the getPassword method if it exists.static boolean
Returns whether to show HBase Configuration in servletstatic void
For debugging.static void
merge
(org.apache.hadoop.conf.Configuration destConf, org.apache.hadoop.conf.Configuration srcConf) Merge two configurations.static void
setWithPrefix
(org.apache.hadoop.conf.Configuration conf, String prefix, Iterable<Map.Entry<String, String>> properties) Sets all the entries in the providedMap<String, String>
as properties in the givenConfiguration
.static org.apache.hadoop.conf.Configuration
Returns a subset of the configuration properties, matching the given key prefix.Methods inherited from class org.apache.hadoop.conf.Configuration
addDefaultResource, addDeprecation, addDeprecation, addDeprecation, addDeprecation, addDeprecations, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, addResource, clear, dumpConfiguration, dumpConfiguration, dumpDeprecatedKeys, get, get, getBoolean, getClass, getClass, getClassByName, getClassByNameOrNull, getClasses, getClassLoader, getConfResourceAsInputStream, getConfResourceAsReader, getDouble, getEnum, getFile, getFinalParameters, getFloat, getInstances, getInt, getInts, getLocalPath, getLong, getLongBytes, getPassword, getPasswordFromConfig, getPasswordFromCredentialProviders, getPattern, getPropertySources, getProps, getPropsWithPrefix, getRange, getRaw, getResource, getSocketAddr, getSocketAddr, getStringCollection, getStrings, getStrings, getTimeDuration, getTimeDuration, getTimeDurations, getTrimmed, getTrimmed, getTrimmedStringCollection, getTrimmedStrings, getTrimmedStrings, getValByRegex, hasWarnedDeprecation, isDeprecated, iterator, onlyKeyExists, readFields, reloadConfiguration, reloadExistingConfigurations, set, set, setAllowNullValueProperties, setBoolean, setBooleanIfUnset, setClass, setClassLoader, setDeprecatedProperties, setDouble, setEnum, setFloat, setIfUnset, setInt, setLong, setPattern, setQuietMode, setRestrictSystemProperties, setRestrictSystemPropertiesDefault, setRestrictSystemProps, setSocketAddr, setStrings, setTimeDuration, size, toString, unset, updateConnectAddr, updateConnectAddr, write, writeXml, writeXml, writeXml
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
LOG
-
-
Constructor Details
-
HBaseConfiguration
Deprecated.since 0.90.0. Please usecreate()
instead.Instantiating HBaseConfiguration() is deprecated. Please use HBaseConfiguration#create() to construct a plain Configuration- See Also:
-
HBaseConfiguration
Deprecated.since 0.90.0. Please usecreate(Configuration)
instead.Instantiating HBaseConfiguration() is deprecated. Please use HBaseConfiguration#create(conf) to construct a plain Configuration- See Also:
-
-
Method Details
-
checkDefaultsVersion
-
addDeprecatedKeys
The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by hbase.server.allocator.max.buffer.count and hbase.server.allocator.buffer.size. Also the hbase.ipc.server.reservoir.enabled will be replaced by hbase.server.allocator.pool.enabled. Keep the three old config keys here for HBase2.x compatibility.
HBASE-24667: This config hbase.regionserver.hostname.disable.master.reversedns will be replaced by hbase.unsafe.regionserver.hostname.disable.master.reversedns. Keep the old config keys here for backward compatibility.
Note: Before Hadoop-3.3, we must call the addDeprecations method before creating the Configuration object to work correctly. After this bug is fixed in hadoop-3.3, there will be no order problem.- See Also:
-
addHbaseResources
public static org.apache.hadoop.conf.Configuration addHbaseResources(org.apache.hadoop.conf.Configuration conf) -
create
Creates a Configuration with HBase resources- Returns:
- a Configuration with HBase resources
-
create
public static org.apache.hadoop.conf.Configuration create(org.apache.hadoop.conf.Configuration that) Creates a Configuration with HBase resources- Parameters:
that
- Configuration to clone.- Returns:
- a Configuration created with the hbase-*.xml files plus the given configuration.
-
merge
public static void merge(org.apache.hadoop.conf.Configuration destConf, org.apache.hadoop.conf.Configuration srcConf) Merge two configurations.- Parameters:
destConf
- the configuration that will be overwritten with items from the srcConfsrcConf
- the source configuration
-
subset
public static org.apache.hadoop.conf.Configuration subset(org.apache.hadoop.conf.Configuration srcConf, String prefix) Returns a subset of the configuration properties, matching the given key prefix. The prefix is stripped from the return keys, ie. when calling with a prefix of "myprefix", the entry "myprefix.key1 = value1" would be returned as "key1 = value1". If an entry's key matches the prefix exactly ("myprefix = value2"), it will not be included in the results, since it would show up as an entry with an empty key. -
setWithPrefix
public static void setWithPrefix(org.apache.hadoop.conf.Configuration conf, String prefix, Iterable<Map.Entry<String, String>> properties) Sets all the entries in the providedMap<String, String>
as properties in the givenConfiguration
. Each property will have the specified prefix prepended, so that the configuration entries are keyed byprefix + entry.getKey()
. -
isShowConfInServlet
Returns whether to show HBase Configuration in servlet -
getInt
@Deprecated public static int getInt(org.apache.hadoop.conf.Configuration conf, String name, String deprecatedName, int defaultValue) Deprecated.it will be removed in 3.0.0. UseConfiguration.addDeprecation(String, String)
instead.Get the value of thename
property as anint
, possibly referring to the deprecated name of the configuration property. If no such property exists, the provided default value is returned, or if the specified value is not a validint
, then an error is thrown.- Parameters:
name
- property name.deprecatedName
- a deprecatedName for the property to use if non-deprecated name is not useddefaultValue
- default value.- Returns:
- property value as an
int
, ordefaultValue
. - Throws:
NumberFormatException
- when the value is invalid
-
getPassword
public static String getPassword(org.apache.hadoop.conf.Configuration conf, String alias, String defPass) throws IOException Get the password from the Configuration instance using the getPassword method if it exists. If not, then fall back to the general get method for configuration elements.- Parameters:
conf
- configuration instance for accessing the passwordsalias
- the name of the password elementdefPass
- the default password- Returns:
- String password or default password
- Throws:
IOException
-
createClusterConf
public static org.apache.hadoop.conf.Configuration createClusterConf(org.apache.hadoop.conf.Configuration baseConf, String clusterKey) throws IOException Generates aConfiguration
instance by applying the ZooKeeper cluster key to the base Configuration. Note that additional configuration properties may be needed for a remote cluster, so it is preferable to usecreateClusterConf(Configuration, String, String)
.- Parameters:
baseConf
- the base configuration to use, containing prefixed override propertiesclusterKey
- the ZooKeeper quorum cluster key to apply, ornull
if none- Returns:
- the merged configuration with override properties and cluster key applied
- Throws:
IOException
- See Also:
-
createClusterConf
public static org.apache.hadoop.conf.Configuration createClusterConf(org.apache.hadoop.conf.Configuration baseConf, String clusterKey, String overridePrefix) throws IOException Generates aConfiguration
instance by applying property overrides prefixed by a cluster profile key to the base Configuration. Override properties are extracted by thesubset(Configuration, String)
method, then the merged on top of the base Configuration and returned.- Parameters:
baseConf
- the base configuration to use, containing prefixed override propertiesclusterKey
- the ZooKeeper quorum cluster key to apply, ornull
if noneoverridePrefix
- the property key prefix to match for override properties, ornull
if none- Returns:
- the merged configuration with override properties and cluster key applied
- Throws:
IOException
-
applyClusterKeyToConf
private static void applyClusterKeyToConf(org.apache.hadoop.conf.Configuration conf, String key) throws IOException Apply the settings in the given key to the given configuration, this is used to communicate with distant clusters- Parameters:
conf
- configuration object to configurekey
- string that contains the 3 required configuratins- Throws:
IOException
-
main
For debugging. Dump configurations to system output as xml format. Master and RS configurations can also be dumped using http services. e.g. "curl http://master:16010/dump"- Throws:
Exception
-