Class ObserverReadProxyProviderWithIPFailover<T extends ClientProtocol>
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider<T>
org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider<T>
org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProviderWithIPFailover<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.io.retry.FailoverProxyProvider<T>
@Private
@Evolving
public class ObserverReadProxyProviderWithIPFailover<T extends ClientProtocol>
extends ObserverReadProxyProvider<T>
Extends
ObserverReadProxyProvider to support NameNode IP failover.
For Observer reads a client needs to know physical addresses of all
NameNodes, so that it could switch between active and observer nodes
for write and read requests.
Traditional IPFailoverProxyProvider works with a virtual
address of the NameNode. If active NameNode fails the virtual address
is assigned to the standby NameNode, and IPFailoverProxyProvider, which
keeps talking to the same virtual address is in fact now connects to
the new physical server.
To combine these behaviors ObserverReadProxyProviderWithIPFailover
should both
- Maintain all physical addresses of NameNodes in order to allow observer reads, and
- Should rely on the virtual address of the NameNode in order to perform failover by assuming that the virtual address always points to the active NameNode.
fs.defaultFS = hdfs://mycluster
dfs.nameservices = mycluster
dfs.ha.namenodes.mycluster = ha1,ha2
dfs.namenode.rpc-address.mycluster.ha1 = nn01-ha1.com:8020
dfs.namenode.rpc-address.mycluster.ha2 = nn01-ha2.com:8020
dfs.client.failover.ipfailover.virtual-address.mycluster =
hdfs://nn01.com:8020
dfs.client.failover.proxy.provider.mycluster =
org.apache...ObserverReadProxyProviderWithIPFailover
Here nn01.com:8020 is the virtual address of the active NameNode,
while nn01-ha1.com:8020 and nn01-ha2.com:8020
are the physically addresses the two NameNodes.
With this configuration, client will use
ObserverReadProxyProviderWithIPFailover, which creates proxies for both
nn01-ha1 and nn01-ha2, used for read/write RPC calls, but for the failover,
it relies on the virtual address nn01.com-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider
AbstractNNFailoverProxyProvider.NNProxyInfo<T>Nested classes/interfaces inherited from interface org.apache.hadoop.io.retry.FailoverProxyProvider
org.apache.hadoop.io.retry.FailoverProxyProvider.ProxyInfo<T extends Object> -
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider
conf, factory, fallbackToSimpleAuth, ugi, xface -
Constructor Summary
ConstructorsConstructorDescriptionObserverReadProxyProviderWithIPFailover(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory) By default ObserverReadProxyProviderWithIPFailover usesIPFailoverProxyProviderfor failover.ObserverReadProxyProviderWithIPFailover(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory, AbstractNNFailoverProxyProvider<T> failoverProxy) -
Method Summary
Modifier and TypeMethodDescriptionbooleanInquire whether logical HA URI is used for the implementation.Methods inherited from class org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider
close, getAlignmentContext, getProxy, performFailoverMethods inherited from class org.apache.hadoop.hdfs.server.namenode.ha.AbstractNNFailoverProxyProvider
createProxyIfNeeded, getFallbackToSimpleAuth, getInterface, getProxyAddresses, getRandomOrder, setFallbackToSimpleAuth
-
Constructor Details
-
ObserverReadProxyProviderWithIPFailover
public ObserverReadProxyProviderWithIPFailover(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory) By default ObserverReadProxyProviderWithIPFailover usesIPFailoverProxyProviderfor failover. -
ObserverReadProxyProviderWithIPFailover
public ObserverReadProxyProviderWithIPFailover(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory, AbstractNNFailoverProxyProvider<T> failoverProxy)
-
-
Method Details
-
useLogicalURI
public boolean useLogicalURI()Description copied from class:AbstractNNFailoverProxyProviderInquire whether logical HA URI is used for the implementation. If it is used, a special token handling may be needed to make sure a token acquired from a node in the HA pair can be used against the other node.- Overrides:
useLogicalURIin classObserverReadProxyProvider<T extends ClientProtocol>- Returns:
- true if logical HA URI is used. false, if not used.
-