Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-20794

Use Zookeeper for metastore service discovery

    XMLWordPrintableJSON

Details

    Description

      Right now, multiple metastore services can be specified in hive.metastore.uris configuration, but that list is static and can not be modified dynamically. Use Zookeeper for dynamic service discovery of metastore.

      Improve ZooKeeperHiveHelper class (suggestions for name welcome)

      The Zookeeper related code (for service discovery) accesses Zookeeper parameters directly from HiveConf. The class is changed so that it could be used for both HiveServer2 and Metastore server and works with both the configurations. Following methods from HiveServer2 are now moved into ZooKeeperHiveHelper. # startZookeeperClient # addServerInstanceToZooKeeper # removeServerInstanceFromZooKeeper

      HiveMetaStore conf changes

      1. THRIFT_URIS (hive.metastore.uris) can also be used to specify ZooKeeper quorum. When THRIFT_SERVICE_DISCOVERY_MODE (hive.metastore.service.discovery.mode) is set to "zookeeper" the URIs are used as ZooKeeper quorum. When it's set to be empty, the URIs are used to locate the metastore directly.
      2. Here's list of Hiveserver2's parameters and their proposed metastore conf counterparts. It looks odd that the Metastore related configurations do not have their macros start with METASTORE, but start with THRIFT. I have just followed naming convention used for other parameters.
        • HIVE_SERVER2_ZOOKEEPER_NAMESPACE - THRIFT_ZOOKEEPER_NAMESPACE (hive.metastore.zookeeper.namespace)
        • HIVE_ZOOKEEPER_CLIENT_PORT - THRIFT_ZOOKEEPER_CLIENT_PORT (hive.metastore.zookeeper.client.port)
        • HIVE_ZOOKEEPER_CONNECTION_TIMEOUT - THRIFT_ZOOKEEPER_CONNECTION_TIMEOUT - (hive.metastore.zookeeper.connection.timeout)
        • HIVE_ZOOKEEPER_CONNECTION_MAX_RETRIES - THRIFT_ZOOKEEPER_CONNECTION_MAX_RETRIES (hive.metastore.zookeeper.connection.max.retries)
        • HIVE_ZOOKEEPER_CONNECTION_BASESLEEPTIME - THRIFT_ZOOKEEPER_CONNECTION_BASESLEEPTIME (hive.metastore.zookeeper.connection.basesleeptime)
      3. Additional configuration THRIFT_BIND_HOST is used to specify the host address to bind Metastore service to. Right now Metastore binds to *, i.e all addresses. Metastore doesn't then know which of those addresses it should add to the ZooKeeper. THRIFT_BIND_HOST solves that problem. When this configuration is specified the metastore server binds to that address and also adds it to the ZooKeeper if dynamic service discovery mode is ZooKeeper.

      Following Hive ZK configurations seem to be related to managing locks and seem irrelevant for MS ZK.

      1. HIVE_ZOOKEEPER_SESSION_TIMEOUT
      2. HIVE_ZOOKEEPER_CLEAN_EXTRA_NODES

      Since there is no configuration to be published, HIVE_ZOOKEEPER_PUBLISH_CONFIGS does not have a THRIFT counterpart.

      HiveMetaStore class changes

      1. startMetaStore should also register the instance with Zookeeper, when configured.
      2. When shutting a metastore server down it should deregister itself from Zookeeper, when configured.
      3. These changes use the refactored code described above.

      HiveMetaStoreClient class changes

      When service discovery mode is zookeeper, we fetch the metatstore URIs from the specified ZooKeeper and treat those as if they were specified in THRIFT_URIS i.e. use the existing mechanisms to choose a metastore server to connect to and establish a connection.

      Attachments

        1. HIVE-20794.01
          53 kB
          Ashutosh Bapat
        2. HIVE-20794.02
          54 kB
          Ashutosh Bapat
        3. HIVE-20794.03
          59 kB
          Ashutosh Bapat
        4. HIVE-20794.03
          59 kB
          Ashutosh Bapat
        5. HIVE-20794.04
          59 kB
          Ashutosh Bapat
        6. HIVE-20794.05
          59 kB
          Ashutosh Bapat
        7. HIVE-20794.06
          59 kB
          Ashutosh Bapat
        8. HIVE-20794.07
          59 kB
          Ashutosh Bapat
        9. HIVE-20794.07
          59 kB
          Ashutosh Bapat
        10. HIVE-20794.08
          59 kB
          Ashutosh Bapat
        11. HIVE-20794.08
          59 kB
          Ashutosh Bapat

        Issue Links

          Activity

            People

              ashutosh.bapat Ashutosh Bapat
              ashutosh.bapat Ashutosh Bapat
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: