Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ED79C18673 for ; Tue, 22 Sep 2015 01:24:03 +0000 (UTC) Received: (qmail 80534 invoked by uid 500); 22 Sep 2015 01:24:03 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 80505 invoked by uid 500); 22 Sep 2015 01:24:03 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 80496 invoked by uid 99); 22 Sep 2015 01:24:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2015 01:24:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A4B41E0509; Tue, 22 Sep 2015 01:24:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jaimin@apache.org To: commits@ambari.apache.org Message-Id: <9684329ffb234644a1d24116fd9df8b7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-13175. Ranger Database related property values should be recommended by stack advisor. (jaimin) Date: Tue, 22 Sep 2015 01:24:03 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-2.1 1e6707e1a -> 6a006eee5 AMBARI-13175. Ranger Database related property values should be recommended by stack advisor. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6a006eee Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6a006eee Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6a006eee Branch: refs/heads/branch-2.1 Commit: 6a006eee5f6f87219a04f52a199be8b2446aad7c Parents: 1e6707e Author: Jaimin Jetly Authored: Mon Sep 21 18:23:03 2015 -0700 Committer: Jaimin Jetly Committed: Mon Sep 21 18:23:59 2015 -0700 ---------------------------------------------------------------------- .../0.4.0/configuration/admin-properties.xml | 6 ++++++ .../stacks/HDP/2.0.6/services/stack_advisor.py | 21 ++++++++++++++++++- .../RANGER/configuration/ranger-admin-site.xml | 20 ++++++++++++++++++ .../stacks/HDP/2.3/services/stack_advisor.py | 22 ++++++++++++++++++++ ambari-web/app/data/db_properties_info.js | 10 --------- ambari-web/app/views/common/controls_view.js | 12 +++++------ 6 files changed, 73 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml index 5fdb1b9..936c332 100644 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml @@ -49,6 +49,12 @@ false + + + admin-properties + DB_FLAVOR + + http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py index 5568e60..b825d31 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py @@ -86,7 +86,8 @@ class HDP206StackAdvisor(DefaultStackAdvisor): "MAPREDUCE2": self.recommendMapReduce2Configurations, "HDFS": self.recommendHDFSConfigurations, "HBASE": self.recommendHbaseConfigurations, - "AMBARI_METRICS": self.recommendAmsConfigurations + "AMBARI_METRICS": self.recommendAmsConfigurations, + "RANGER": self.recommendRangerConfigurations } def putProperty(self, config, configType, services=None): @@ -241,6 +242,24 @@ class HDP206StackAdvisor(DefaultStackAdvisor): and services['configurations']['hbase-env']['properties']['hbase_user'] != services['configurations']['hbase-site']['properties']['hbase.superuser']: putHbaseSiteProperty("hbase.superuser", services['configurations']['hbase-env']['properties']['hbase_user']) + + def recommendRangerConfigurations(self, configurations, clusterData, services, hosts): + ranger_sql_connector_dict = { + 'MYSQL': '/usr/share/java/mysql-connector-java.jar', + 'ORACLE': '/usr/share/java/ojdbc6.jar', + 'POSTGRES': '/usr/share/java/postgresql.jar', + 'MSSQL': '/usr/share/java/sqljdbc4.jar', + 'SQLA': '/path_to_driver/sqla-client-jdbc.tar.gz' + } + + putRangerAdminProperty = self.putProperty(configurations, "admin-properties", services) + + if 'admin-properties' in services['configurations'] and 'DB_FLAVOR' in services['configurations']['admin-properties']['properties']: + rangerDbFlavor = services['configurations']["admin-properties"]["properties"]["DB_FLAVOR"] + rangerSqlConnectorProperty = ranger_sql_connector_dict.get(rangerDbFlavor, ranger_sql_connector_dict['MYSQL']) + putRangerAdminProperty('SQL_CONNECTOR_JAR', rangerSqlConnectorProperty) + + def getAmsMemoryRecommendation(self, services, hosts): # MB per sink in hbase heapsize HEAP_PER_MASTER_COMPONENT = 50 http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml index 43be765..7423e8d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml @@ -96,6 +96,12 @@ false + + + admin-properties + DB_FLAVOR + + @@ -106,6 +112,20 @@ false + + + admin-properties + DB_FLAVOR + + + admin-properties + db_host + + + admin-properties + db_name + + http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py index d7ea10f..16fb7a5 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py @@ -30,6 +30,7 @@ class HDP23StackAdvisor(HDP22StackAdvisor): "HIVE": self.recommendHIVEConfigurations, "HBASE": self.recommendHBASEConfigurations, "KAFKA": self.recommendKAFKAConfigurations, + "RANGER": self.recommendRangerConfigurations } parentRecommendConfDict.update(childRecommendConfDict) return parentRecommendConfDict @@ -251,6 +252,27 @@ class HDP23StackAdvisor(HDP22StackAdvisor): if ("RANGER" in servicesList) and (rangerPluginEnabled.lower() == "Yes".lower()): putKafkaBrokerProperty("authorizer.class.name", 'org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer') + def recommendRangerConfigurations(self, configurations, clusterData, services, hosts): + super(HDP23StackAdvisor, self).recommendRangerConfigurations(configurations, clusterData, services, hosts) + putRangerAdminProperty = self.putProperty(configurations, "ranger-admin-site", services) + + if 'admin-properties' in services['configurations'] and ('DB_FLAVOR' in services['configurations']['admin-properties']['properties'])\ + and ('db_host' in services['configurations']['admin-properties']['properties']) and ('db_name' in services['configurations']['admin-properties']['properties']): + + rangerDbFlavor = services['configurations']["admin-properties"]["properties"]["DB_FLAVOR"] + rangerDbHost = services['configurations']["admin-properties"]["properties"]["db_host"] + rangerDbName = services['configurations']["admin-properties"]["properties"]["db_name"] + ranger_db_driver_dict = { + 'MYSQL': {'ranger.jpa.jdbc.driver': 'com.mysql.jdbc.Driver', 'ranger.jpa.jdbc.url': 'jdbc:mysql://' + rangerDbHost + '/' + rangerDbName}, + 'ORACLE': {'ranger.jpa.jdbc.driver': 'oracle.jdbc.driver.OracleDriver', 'ranger.jpa.jdbc.url': 'jdbc:oracle:thin:@/' + rangerDbHost + ':1521/' + rangerDbName}, + 'POSTGRES': {'ranger.jpa.jdbc.driver': 'org.postgresql.Driver', 'ranger.jpa.jdbc.url': 'jdbc:postgresql://' + rangerDbHost + ':5432/' + rangerDbName}, + 'MSSQL': {'ranger.jpa.jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', 'ranger.jpa.jdbc.url': 'jdbc:sqlserver://' + rangerDbHost + ';databaseName=' + rangerDbName}, + 'SQLA': {'ranger.jpa.jdbc.driver': 'sap.jdbc4.sqlanywhere.IDriver', 'ranger.jpa.jdbc.url': 'jdbc:sqlanywhere:host=' + rangerDbHost + ';database=' + rangerDbName} + } + rangerDbProperties = ranger_db_driver_dict.get(rangerDbFlavor, ranger_db_driver_dict['MYSQL']) + for key in rangerDbProperties: + putRangerAdminProperty(key, rangerDbProperties.get(key)) + def getServiceConfigurationValidators(self): parentValidators = super(HDP23StackAdvisor, self).getServiceConfigurationValidators() childValidators = { http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-web/app/data/db_properties_info.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/data/db_properties_info.js b/ambari-web/app/data/db_properties_info.js index d48dc98..0477677 100644 --- a/ambari-web/app/data/db_properties_info.js +++ b/ambari-web/app/data/db_properties_info.js @@ -54,16 +54,6 @@ module.exports = { user_name: 'oozie.service.JPAService.jdbc.username', password: 'oozie.service.JPAService.jdbc.password' - }, - 'RANGER': { - db_selector: 'DB_FLAVOR', - - host_name: 'db_host', - db_name: 'db_name', - - connection_url: App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.url' : 'ranger_jdbc_connection_url', - driver: App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.driver' : 'ranger_jdbc_driver', - sql_jar_connector: 'SQL_CONNECTOR_JAR' } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/6a006eee/ambari-web/app/views/common/controls_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js index a7bf5a0..30e0b94 100644 --- a/ambari-web/app/views/common/controls_view.js +++ b/ambari-web/app/views/common/controls_view.js @@ -504,13 +504,13 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId, } else { this.get('hostNameProperty').set('isEditable', true); } - this.setRequiredProperties(['driver', 'sql_jar_connector', 'db_type']); + this.setRequiredProperties(['driver', 'db_type']); if (this.getPropertyByType('connection_url')) { - this.setConnectionUrl(this.get('hostNameProperty.value'), this.get('databaseProperty.value'), this.get('userProperty.value'), this.get('passwordProperty.value')); + this.setConnectionUrl(this.get('hostNameProperty.value'), this.get('databaseProperty.value')); } this.handleSpecialUserPassProperties(); } - }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value', 'userProperty.value', 'passwordProperty.value'), + }.observes('databaseProperty.value', 'hostNameProperty.value', 'serviceConfig.value'), nameBinding: 'serviceConfig.radioName', @@ -585,15 +585,13 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId, * and sets hostName as dbName in appropriate position of connection_url string * @param {String} hostName * @param {String} dbName - * @param {String} user - * @param {String} password * @method setConnectionUrl */ - setConnectionUrl: function(hostName, dbName, user, password) { + setConnectionUrl: function(hostName, dbName) { var connectionUrlProperty = this.getPropertyByType('connection_url'); var connectionUrlTemplate = this.getDefaultPropertyValue('connection_url'); try { - var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName, user, password); + var connectionUrlValue = connectionUrlTemplate.format(hostName, dbName); connectionUrlProperty.set('value', connectionUrlValue); connectionUrlProperty.set('recommendedValue', connectionUrlValue); } catch(e) {