Class ObserverReadProxyProviderWithIPFailover<T extends ClientProtocol>

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
  1. Maintain all physical addresses of NameNodes in order to allow observer reads, and
  2. 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.
An example of a configuration to leverage ObserverReadProxyProviderWithIPFailover should include the following values:

 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
  • Constructor Details

    • ObserverReadProxyProviderWithIPFailover

      public ObserverReadProxyProviderWithIPFailover(org.apache.hadoop.conf.Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory)
      By default ObserverReadProxyProviderWithIPFailover uses IPFailoverProxyProvider for 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: AbstractNNFailoverProxyProvider
      Inquire 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:
      useLogicalURI in class ObserverReadProxyProvider<T extends ClientProtocol>
      Returns:
      true if logical HA URI is used. false, if not used.