Ver Fonte

AMBARI-8906. Support for HiveServer2 HA in Ambari.(vbrodetskyi)

Vitaly Brodetskyi há 10 anos atrás
pai
commit
f93c6031ae

+ 1 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py

@@ -125,6 +125,7 @@ hive_metastore_port = get_port_from_url(config['configurations']['hive-site']['h
 hive_var_lib = '/var/lib/hive'
 ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]
 hive_server_host = config['clusterHostInfo']['hive_server_host'][0]
+hive_server_hosts = config['clusterHostInfo']['hive_server_host']
 hive_server_port = default('/configurations/hive-site/hive.server2.thrift.port',"10000")
 hive_url = format("jdbc:hive2://{hive_server_host}:{hive_server_port}")
 hive_server_principal = config['configurations']['hive-site']['hive.server2.authentication.kerberos.principal']

+ 13 - 8
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py

@@ -30,20 +30,25 @@ class HiveServiceCheck(Script):
     import params
     env.set_params(params)
 
-    address=format("{hive_server_host}")
-    port=int(format("{hive_server_port}"))
+    address_list = params.hive_server_hosts
+    port = int(format("{hive_server_port}"))
     print "Test connectivity to hive server"
     if params.security_enabled:
       kinitcmd=format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser}; ")
     else:
       kinitcmd=None
 
-    try:
-      check_thrift_port_sasl(address, port, params.hive_server2_authentication,
-                             params.hive_server_principal, kinitcmd, params.smokeuser)
-      print "Successfully connected to %s on port %s" % (address, port)
-    except:
-      print "Connection to %s on port %s failed" % (address, port)
+    workable_server_available = False
+    for address in address_list:
+      try:
+        check_thrift_port_sasl(address, port, params.hive_server2_authentication,
+                               params.hive_server_principal, kinitcmd, params.smokeuser)
+        print "Successfully connected to %s on port %s" % (address, port)
+        workable_server_available = True
+      except:
+        print "Connection to %s on port %s failed" % (address, port)
+
+    if not workable_server_available:
       exit(1)
 
     hcat_service_check()

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml

@@ -43,6 +43,7 @@
         </component>
         <component>
           <name>HIVE_SERVER</name>
+          <cardinality>1+</cardinality>
           <configuration-dependencies>
               <config-type>hiveserver2-site</config-type>
           </configuration-dependencies>