Repository: ambari
Updated Branches:
  refs/heads/trunk 14c614fb9 -> f93c6031a


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


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f93c6031
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f93c6031
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f93c6031

Branch: refs/heads/trunk
Commit: f93c6031ae3e6fc69c321088d43cff73978a4202
Parents: 14c614f
Author: Vitaly Brodetskyi <[email protected]>
Authored: Wed Dec 24 15:54:51 2014 +0200
Committer: Vitaly Brodetskyi <[email protected]>
Committed: Wed Dec 24 15:54:51 2014 +0200

----------------------------------------------------------------------
 .../HIVE/0.12.0.2.0/package/scripts/params.py   |  1 +
 .../0.12.0.2.0/package/scripts/service_check.py | 21 ++++++++++++--------
 .../stacks/HDP/2.2/services/HIVE/metainfo.xml   |  1 +
 3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f93c6031/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
index 86f95b8..97af1a5 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py
+++ 
b/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']

http://git-wip-us.apache.org/repos/asf/ambari/blob/f93c6031/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py
index 945a676..4e8b886 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py
+++ 
b/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()

http://git-wip-us.apache.org/repos/asf/ambari/blob/f93c6031/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml
index da712b9..9831195 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml
+++ b/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>

Reply via email to