Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C44DF200C59 for ; Mon, 17 Apr 2017 22:17:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C3259160BBE; Mon, 17 Apr 2017 20:17:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D2C8B160BAE for ; Mon, 17 Apr 2017 22:17:58 +0200 (CEST) Received: (qmail 85219 invoked by uid 500); 17 Apr 2017 20:17:58 -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 83994 invoked by uid 99); 17 Apr 2017 20:17:57 -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; Mon, 17 Apr 2017 20:17:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 43B25F216D; Mon, 17 Apr 2017 20:17:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Mon, 17 Apr 2017 20:18:16 -0000 Message-Id: <3362c4e0f6144c8985da60ce498dfac6@git.apache.org> In-Reply-To: <4f6fbdf340894685baf3d6c420865507@git.apache.org> References: <4f6fbdf340894685baf3d6c420865507@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [22/34] ambari git commit: AMBARI-20762. Add more database options for BEACON in stack advisor.(xiwang) archived-at: Mon, 17 Apr 2017 20:17:59 -0000 AMBARI-20762. Add more database options for BEACON in stack advisor.(xiwang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c57300a3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c57300a3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c57300a3 Branch: refs/heads/branch-feature-AMBARI-12556 Commit: c57300a359bfdb3225e2660a661733fc58daac2c Parents: 38f84bf Author: Xi Wang Authored: Thu Apr 13 14:10:16 2017 -0700 Committer: Xi Wang Committed: Thu Apr 13 16:11:44 2017 -0700 ---------------------------------------------------------------------- .../stacks/HDP/2.6/services/stack_advisor.py | 33 +++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c57300a3/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py index 38f46d7..4e1b4b6 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py @@ -40,11 +40,42 @@ class HDP26StackAdvisor(HDP25StackAdvisor): "HIVE": self.recommendHIVEConfigurations, "HBASE": self.recommendHBASEConfigurations, "YARN": self.recommendYARNConfigurations, - "KAFKA": self.recommendKAFKAConfigurations + "KAFKA": self.recommendKAFKAConfigurations, + "BEACON": self.recommendBEACONConfigurations } parentRecommendConfDict.update(childRecommendConfDict) return parentRecommendConfDict + def recommendBEACONConfigurations(self, configurations, clusterData, services, hosts): + beaconEnvProperties = self.getSiteProperties(services['configurations'], 'beacon-env') + putbeaconEnvProperty = self.putProperty(configurations, "beacon-env", services) + + # database URL and driver class recommendations + if beaconEnvProperties and self.checkSiteProperties(beaconEnvProperties, 'beacon_store_driver') and self.checkSiteProperties(beaconEnvProperties, 'beacon_database'): + putbeaconEnvProperty('beacon_store_driver', self.getDBDriver(beaconEnvProperties['beacon_database'])) + if beaconEnvProperties and self.checkSiteProperties(beaconEnvProperties, 'beacon_store_db_name', 'beacon_store_url') and self.checkSiteProperties(beaconEnvProperties, 'beacon_database'): + beaconServerHost = self.getHostWithComponent('BEACON', 'BEACON_SERVER', services, hosts) + beaconDBConnectionURL = beaconEnvProperties['beacon_store_url'] + protocol = self.getProtocol(beaconEnvProperties['beacon_database']) + oldSchemaName = self.getOldValue(services, "beacon-env", "beacon_store_db_name") + oldDBType = self.getOldValue(services, "beacon-env", "beacon_database") + # under these if constructions we are checking if beacon server hostname available, + # if it's default db connection url with "localhost" or if schema name was changed or if db type was changed (only for db type change from default mysql to existing mysql) + # or if protocol according to current db type differs with protocol in db connection url(other db types changes) + if beaconServerHost is not None: + if (beaconDBConnectionURL and "//localhost" in beaconDBConnectionURL) or oldSchemaName or oldDBType or (protocol and beaconDBConnectionURL and not beaconDBConnectionURL.startswith(protocol)): + dbConnection = self.getDBConnectionStringBeacon(beaconEnvProperties['beacon_database']).format(beaconServerHost['Hosts']['host_name'], beaconEnvProperties['beacon_store_db_name']) + putbeaconEnvProperty('beacon_store_url', dbConnection) + + def getDBConnectionStringBeacon(self, databaseType): + driverDict = { + 'NEW DERBY DATABASE': 'jdbc:derby:${{beacon.data.dir}}/${{beacon.store.db.name}}-db;create=true', + 'EXISTING MYSQL DATABASE': 'jdbc:mysql://{0}/{1}', + 'EXISTING MYSQL / MARIADB DATABASE': 'jdbc:mysql://{0}/{1}', + 'EXISTING ORACLE DATABASE': 'jdbc:oracle:thin:@//{0}:1521/{1}' + } + return driverDict.get(databaseType.upper()) + def recommendAtlasConfigurations(self, configurations, clusterData, services, hosts): super(HDP26StackAdvisor, self).recommendAtlasConfigurations(configurations, clusterData, services, hosts) servicesList = [service["StackServices"]["service_name"] for service in services["services"]]