Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Provider configuration example

 

Enables or disables HA Provider and binds strategy and provider together. Alias contains list of Hadoop services (name-nodes in our case: active and standby) grouped into one entity.

 

Code Block
languagexml
titleTopology
linenumberstrue
<topology>
  <gateway>
    ...
    <provider>
    <role>ha</role>
    <name>HAProvider</name>
    <param>
        <name>webhdfs.ha</name>
        <value>failover_strategy=BaseStrategy;retryCount=3;timeoutInterval=5000;enabled=true</value>
    </param>
</provider>
    ...
  <gateway>
  ...
  <service>
    <role>WEBHDFS</role>
    <url>machine1.example.com:50070</url>
    <url>machine2.example.com:50070</url>
  </service>
  ...
<service>
    <role>NAMENODE</role>
    <url>machine1.example.com:50070</url>
    <url>machine2.example.com:50070</url>
</service>
...
</topology>

Parameters description:

  • failover_strategy – indicates how to define active service and contains some configuration parameters. Default value is BaseStrategy. BaseStrategy for failover has following parameters:
  • retryCount – indicates how many times knox will ping name-node before  knox decides that namenode is down.
  • timeoutInterval – interval for connection timeout. 
  • enabled – indicates whether  HAProvider  is active or not for service.

 

Example UML

PlantUML
border1
titleDiagram Title
hide footbox
autonumber

participant "Deployment\nFactory\n(df)" as df

Example Code Block

Code Block
languagejava
titleHaBaseStrategyHostMapper
linenumberstrue
public class HaBaseStrategyHostMapper implements HostMapper {

    @Override
    public String resolveInboundHostName(String inboundHost) {
 		//TODO: implement host resolution here
        return null;
    }
    @Override
    public String resolveOutboundHostName(String outboundHost) {
		//TODO: implement host resolution here
        return null;
    }
}
Code Block
languagejava
titleHaUrlRewriteFunctionDescriptor
linenumberstrue
public class HaUrlRewriteFunctionDescriptor implements UrlRewriteFunctionDescriptor<HaUrlRewriteFunctionDescriptor> {
    public static final String FUNCTION_NAME = "ha-rewrite";
    private String configLocation;
    @Override
    public String name() {
        return FUNCTION_NAME;
    }
    public HaUrlRewriteFunctionDescriptor config( String configLocation ) {
        this.configLocation = configLocation;
        return this;
    }
    public String config() {
        return configLocation;
    }
    public String getConfig() {
        return config();
    }
    public void setConfig( String configLocation ) {
        config( configLocation );
    }
}

...

languagejava
titleHaUrlRewriteFunctionProcessor
linenumberstrue

...

Please look at the WebHDFS HA section http://knox.apache.org/books/knox-0-5-0/knox-0-5-0.html#WebHDFS 

 

...