Class AMRegistry

java.lang.Object
org.apache.drill.yarn.zk.AMRegistry

public class AMRegistry extends Object
Register this App Master in ZK to prevent duplicates.

Possible enhancement is to put the registry in some well-known location, such as /drill-am,

  • Constructor Details

  • Method Details

    • useLocalRegistry

      public void useLocalRegistry(String zkRoot, String clusterId)
    • register

      public void register(String amHost, int amPort, String amAppId) throws ZKRuntimeException
      Register this AM as an ephemeral znode in ZK. The structure of ZK is as follows:
       /drill
       . <cluster-id>
       . . <Drillbit GUID> (Value is Proto-encoded drillbit info)
       . drill-on-yarn
       . . <cluster-id> (value: amHost:port)
       

      The structure acknowledges that the cluster-id znode may be renamed, and there may be multiple cluster IDs for a single drill root node. (Odd, but supported.) To address this, we put the AM registrations in their own (persistent) znode: drill-on-yarn. Each is keyed by the cluster ID (so we can find it), and holds the host name, HTTP port and Application ID of the AM.

      When the AM starts, it atomically checks and sets the AM registration. If another AM already is running, then this AM will fail, displaying a log error message with the host, port and (most importantly) app ID so the user can locate the problem.

      Throws:
      ZKRuntimeException