AMBARI-20343 Zeppelin: Configure both Hive and Hive interactive interpreters 
whenever required (r-kamath)


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

Branch: refs/heads/branch-dev-logsearch
Commit: c7086b11b7e5536e0c8b56130774e728aa3363f6
Parents: ec33f22
Author: Renjith Kamath <[email protected]>
Authored: Thu Mar 9 12:44:31 2017 +0530
Committer: Renjith Kamath <[email protected]>
Committed: Thu Mar 9 12:44:31 2017 +0530

----------------------------------------------------------------------
 .../0.6.0.2.5/package/scripts/master.py         | 29 +++++++++++++++++---
 .../0.6.0.2.5/package/scripts/params.py         | 10 +++++++
 2 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7086b11/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
index fc24918..a460aec 100644
--- 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
+++ 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
@@ -319,10 +319,15 @@ class Master(Script):
       config_id = livy2_config["id"]
       interpreter_settings[config_id] = livy2_config
 
+    hive_interactive_properties_key = 'hive_interactive'
     for setting_key in interpreter_settings.keys():
       interpreter = interpreter_settings[setting_key]
       if interpreter['group'] == 'jdbc':
         interpreter['dependencies'] = []
+
+        if not params.hive_server_host and 
params.hive_server_interactive_hosts:
+          hive_interactive_properties_key = 'hive'
+
         if params.hive_server_host:
           interpreter['properties']['hive.driver'] = 
'org.apache.hive.jdbc.HiveDriver'
           interpreter['properties']['hive.user'] = 'hive'
@@ -330,17 +335,33 @@ class Master(Script):
           if params.hive_server2_support_dynamic_service_discovery:
             interpreter['properties']['hive.url'] = 'jdbc:hive2://' + \
                                                  params.hive_zookeeper_quorum 
+ \
-                                                 '/;' + 
'serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2'
+                                                 '/;' + 
'serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=' + \
+                                                    
params.hive_zookeeper_namespace
           else:
             interpreter['properties']['hive.url'] = 'jdbc:hive2://' + \
                                                  params.hive_server_host + \
                                                      ':' + 
params.hive_server_port
+        if params.hive_server_interactive_hosts:
+          interpreter['properties'][hive_interactive_properties_key + 
'.driver'] = 'org.apache.hive.jdbc.HiveDriver'
+          interpreter['properties'][hive_interactive_properties_key + '.user'] 
= 'hive'
+          interpreter['properties'][hive_interactive_properties_key + 
'.password'] = ''
+          if params.hive_server2_support_dynamic_service_discovery:
+            interpreter['properties'][hive_interactive_properties_key + 
'.url'] = 'jdbc:hive2://' + \
+                                                    
params.hive_zookeeper_quorum + \
+                                                    '/;' + 
'serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=' + \
+                                                    
params.hive_interactive_zookeeper_namespace
+          else:
+            interpreter['properties'][hive_interactive_properties_key + 
'.url'] = 'jdbc:hive2://' + \
+                                                    
params.hive_server_interactive_hosts + \
+                                                    ':' + 
params.hive_server_port
+
+        if params.hive_server_host or params.hive_server_interactive_hosts:
           interpreter['dependencies'].append(
-              {"groupArtifactVersion": "org.apache.hive:hive-jdbc:2.0.1", 
"local": "false"})
+            {"groupArtifactVersion": "org.apache.hive:hive-jdbc:2.0.1", 
"local": "false"})
           interpreter['dependencies'].append(
-              {"groupArtifactVersion": 
"org.apache.hadoop:hadoop-common:2.7.2", "local": "false"})
+            {"groupArtifactVersion": "org.apache.hadoop:hadoop-common:2.7.2", 
"local": "false"})
           interpreter['dependencies'].append(
-              {"groupArtifactVersion": 
"org.apache.hive.shims:hive-shims-0.23:2.1.0", "local": "false"})
+            {"groupArtifactVersion": 
"org.apache.hive.shims:hive-shims-0.23:2.1.0", "local": "false"})
 
         if params.zookeeper_znode_parent \
                 and params.hbase_zookeeper_quorum:

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7086b11/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/params.py
index 9fd105b..fdc96db 100644
--- 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/params.py
@@ -123,6 +123,9 @@ hive_server_port = None
 hive_zookeeper_quorum = None
 hive_server2_support_dynamic_service_discovery = None
 is_hive_installed = False
+hive_zookeeper_namespace = None
+hive_interactive_zookeeper_namespace = None
+
 if 'hive_server_host' in master_configs and 
len(master_configs['hive_server_host']) != 0:
   is_hive_installed = True
   spark_hive_properties = {
@@ -134,8 +137,15 @@ if 'hive_server_host' in master_configs and 
len(master_configs['hive_server_host
     
get_port_from_url(config['configurations']['hive-site']['hive.metastore.uris']))
   hive_server_port = 
str(config['configurations']['hive-site']['hive.server2.thrift.http.port'])
   hive_zookeeper_quorum = 
config['configurations']['hive-site']['hive.zookeeper.quorum']
+  hive_zookeeper_namespace = 
config['configurations']['hive-site']['hive.server2.zookeeper.namespace']
   hive_server2_support_dynamic_service_discovery = 
config['configurations']['hive-site']['hive.server2.support.dynamic.service.discovery']
 
+hive_server_interactive_hosts = None
+if 'hive_server_interactive_hosts' in master_configs and 
len(master_configs['hive_server_interactive_hosts']) != 0:
+    hive_server_interactive_hosts = 
str(master_configs['hive_server_interactive_hosts'][0])
+    hive_interactive_zookeeper_namespace = 
config['configurations']['hive-interactive-site']['hive.server2.zookeeper.namespace']
+    hive_server_port = 
str(config['configurations']['hive-site']['hive.server2.thrift.http.port'])
+
 # detect hbase details if installed
 zookeeper_znode_parent = None
 hbase_zookeeper_quorum = None

Reply via email to