Przeglądaj źródła

AMBARI-11337. Ranger database check: Misc UI tweaks (akovalenko)

Aleksandr Kovalenko 10 lat temu
rodzic
commit
a8fc9a263c

+ 1 - 1
ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/admin-properties.xml

@@ -54,7 +54,7 @@
 
   <property>
     <name>db_host</name>
-    <value>localhost</value>
+    <value></value>
     <description>Database host</description>
   </property>
 

+ 1 - 13
ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml

@@ -86,22 +86,10 @@
     <description></description>
   </property>
 
-  <property>
-    <name>ranger_jdbc_connection_url</name>
-    <value>jdbc:mysql://localhost</value>
-    <description>Ranger JDBC connection url, mainly used for database test connection</description>
-  </property>
-
-  <property>
-    <name>ranger_jdbc_driver</name>
-    <value>com.mysql.jdbc.Driver</value>
-    <description>Ranger JDBC driver, mainly used for database test connection</description>
-  </property>
-
   <property>
     <name>ranger_pid_dir</name>
     <value>/var/run/ranger</value>
     <description></description>
   </property>    
 
-</configuration>
+</configuration>

+ 3 - 11
ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py

@@ -96,30 +96,22 @@ java_share_dir = '/usr/share/java'
 if db_flavor.lower() == 'mysql':
   jdbc_symlink_name = "mysql-jdbc-driver.jar"
   jdbc_jar_name = "mysql-connector-java.jar"
-  db_jdbc_url = format('jdbc:log4jdbc:mysql://{db_host}/{ranger_db_name}')
-  audit_jdbc_url = format('jdbc:log4jdbc:mysql://{db_host}/{ranger_auditdb_name}')
-  jdbc_driver = "net.sf.log4jdbc.DriverSpy"
+  audit_jdbc_url = format('jdbc:mysql://{db_host}/{ranger_auditdb_name}')
   jdbc_dialect = "org.eclipse.persistence.platform.database.MySQLPlatform"
 elif db_flavor.lower() == 'oracle':
   jdbc_jar_name = "ojdbc6.jar"
   jdbc_symlink_name = "oracle-jdbc-driver.jar"
-  db_jdbc_url = format('jdbc:oracle:thin:\@//{db_host}')
   audit_jdbc_url = format('jdbc:oracle:thin:\@//{db_host}')
-  jdbc_driver = "oracle.jdbc.OracleDriver"
   jdbc_dialect = "org.eclipse.persistence.platform.database.OraclePlatform"
 elif db_flavor.lower() == 'postgres':
   jdbc_jar_name = "postgresql.jar"
   jdbc_symlink_name = "postgres-jdbc-driver.jar"
-  db_jdbc_url = format('jdbc:postgresql://{db_host}/{ranger_db_name}')
   audit_jdbc_url = format('jdbc:postgresql://{db_host}/{ranger_auditdb_name}')
-  jdbc_driver = "org.postgresql.Driver"
   jdbc_dialect = "org.eclipse.persistence.platform.database.PostgreSQLPlatform"
 elif db_flavor.lower() == 'sqlserver':
   jdbc_jar_name = "sqljdbc4.jar"
   jdbc_symlink_name = "mssql-jdbc-driver.jar"
-  db_jdbc_url = format('jdbc:sqlserver://{db_host};databaseName={ranger_db_name}')
   audit_jdbc_url = format('jdbc:sqlserver://{db_host};databaseName={ranger_auditdb_name}')
-  jdbc_driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
   jdbc_dialect = "org.eclipse.persistence.platform.database.SQLServerPlatform"
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
@@ -130,8 +122,8 @@ driver_curl_target = format("{java_share_dir}/{jdbc_jar_name}")
 #for db connection
 check_db_connection_jar_name = "DBConnectionVerification.jar"
 check_db_connection_jar = format("/usr/lib/ambari-agent/{check_db_connection_jar_name}")
-ranger_jdbc_connection_url = config["configurations"]["ranger-env"]["ranger_jdbc_connection_url"]
-ranger_jdbc_driver = config["configurations"]["ranger-env"]["ranger_jdbc_driver"]
+ranger_jdbc_connection_url = config["configurations"]["ranger-admin-site"]["ranger.jpa.jdbc.url"]
+ranger_jdbc_driver = config["configurations"]["ranger-admin-site"]["ranger.jpa.jdbc.driver"]
 
 ranger_credential_provider_path = config["configurations"]["ranger-admin-site"]["ranger.credential.provider.path"]
 ranger_jpa_jdbc_credential_alias = config["configurations"]["ranger-admin-site"]["ranger.jpa.jdbc.credential.alias"]

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/admin-properties.xml

@@ -81,4 +81,9 @@
     <deleted>true</deleted>
   </property>
 
+  <property>
+    <name>SQL_COMMAND_INVOKER</name>
+    <deleted>true</deleted>
+  </property>
+
 </configuration>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml

@@ -80,13 +80,13 @@
 
   <property>
     <name>ranger.jpa.jdbc.driver</name>
-    <value>{{jdbc_driver}}</value>
+    <value>com.mysql.jdbc.Driver</value>
     <description></description>
   </property>
 
   <property>
     <name>ranger.jpa.jdbc.url</name>
-    <value>{{db_jdbc_url}}</value>
+    <value>jdbc:mysql://localhost</value>
     <description></description>
   </property> 
 
@@ -177,7 +177,7 @@
 
   <property>
     <name>ranger.jpa.audit.jdbc.driver</name>
-    <value>{{jdbc_driver}}</value>
+    <value>{{ranger_jdbc_driver}}</value>
     <description></description>
   </property>
 

+ 7 - 0
ambari-web/app/controllers/main/service/info/configs.js

@@ -1183,6 +1183,13 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
       serviceName: 'STORM',
       serviceUseThis: [],
       m: true
+    },
+    {
+      hostProperty: 'rangerserver_host',
+      componentName: 'RANGER_ADMIN',
+      serviceName: 'RANGER',
+      serviceUseThis: [],
+      m: true
     }
   ],
 

+ 20 - 10
ambari-web/app/data/HDP2.2/site_properties.js

@@ -457,7 +457,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 1
   },
   {
     "id": "site property",
@@ -483,7 +484,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 2
   },
   {
     "id": "site property",
@@ -496,7 +498,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 5
   },
   {
     "id": "site property",
@@ -509,7 +512,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 6
   },
   {
     "id": "site property",
@@ -522,7 +526,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 7
   },
 
   {
@@ -536,7 +541,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 3
   },
   {
     "id": "site property",
@@ -549,7 +555,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 4
   },
   {
     "id": "site property",
@@ -562,7 +569,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 11
   },
   {
     "id": "site property",
@@ -575,7 +583,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 12
   },
   {
     "id": "site property",
@@ -588,7 +597,8 @@ hdp22properties.push(
     "isVisible": true,
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
-    "category": "DBSettings"
+    "category": "DBSettings",
+    "index": 13
   },
   {
     "id": "puppet var",

+ 36 - 26
ambari-web/app/data/HDP2.3/site_properties.js

@@ -22,7 +22,6 @@ var hdp22properties = require('data/HDP2.2/site_properties').configProperties;
 
 var excludedConfigs = [
   'DB_FLAVOR',
-  'SQL_COMMAND_INVOKER',
   'db_name',
   'db_root_user',
   'db_root_password',
@@ -82,7 +81,7 @@ hdp23properties.push({
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
-    "index": 0
+    "index": 1
   },
   {
     "name": "ranger_mysql_database",
@@ -515,22 +514,7 @@ hdp23properties.push({
     "index": 9
   },
   {
-    "name": "SQL_COMMAND_INVOKER",
-    "id": "site property",
-    "displayName": "SQL Command Invoker",
-    "recommendedValue": "mysql",
-    "isObserved": true,
-    "isReconfigurable": true,
-    "displayType": "",
-    "isOverridable": false,
-    "isVisible": true,
-    "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
-    "category": "DBSettings",
-    "index": 10
-  },
-  {
-    "name": "ranger_jdbc_connection_url",
+    "name": "ranger.jpa.jdbc.url",
     "id": "site property",
     "displayName": "JDBC connect string for a Ranger database",
     "recommendedValue": "",
@@ -540,12 +524,12 @@ hdp23properties.push({
     "isObserved": true,
     "isVisible": true,
     "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
+    "filename": "ranger-admin-site.xml",
     "category": "DBSettings",
-    "index": 11
+    "index": 9
   },
   {
-    "name": "ranger_jdbc_driver",
+    "name": "ranger.jpa.jdbc.driver",
     "id": "site property",
     "displayName": "Driver class name for a JDBC Ranger database",
     "recommendedValue": "",
@@ -555,9 +539,9 @@ hdp23properties.push({
     "isOverridable": false,
     "isVisible": true,
     "serviceName": "RANGER",
-    "filename": "admin-properties.xml",
+    "filename": "ranger-admin-site.xml",
     "category": "DBSettings",
-    "index": 12
+    "index": 8
   },
   {
     "name": "db_root_user",
@@ -572,7 +556,7 @@ hdp23properties.push({
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
-    "index": 13
+    "index": 5
   },
   {
     "name": "db_root_password",
@@ -587,7 +571,7 @@ hdp23properties.push({
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
-    "index": 14
+    "index": 6
   },
   {
     "name": "db_name",
@@ -602,7 +586,7 @@ hdp23properties.push({
     "serviceName": "RANGER",
     "filename": "admin-properties.xml",
     "category": "DBSettings",
-    "index": 15
+    "index": 7
   },
   {
     "id": "site property",
@@ -626,6 +610,19 @@ hdp23properties.push({
     "filename": "ranger-admin-site.xml",
     "category": "RangerSettings"
   },
+  {
+    "id": "puppet var",
+    "name": "ranger.externalurl",
+    "displayName": "External URL",
+    "recommendedValue": "http://localhost:6080",
+    "isReconfigurable": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": false,
+    "serviceName": "RANGER",
+    "filename": "ranger-admin-site.xml",
+    "category": "RangerSettings"
+  },
   {
     "id": "puppet var",
     "name": "ranger.service.http.enabled",
@@ -670,6 +667,19 @@ hdp23properties.push({
     "filename": "ranger-admin-site.xml",
     "category": "RangerSettings"
   },
+  {
+    "id": "puppet var",
+    "name": "policymgr_external_url",
+    "displayName": "External URL",
+    "recommendedValue": "http://localhost:6080",
+    "isReconfigurable": true,
+    "displayType": "",
+    "isOverridable": false,
+    "isVisible": true,
+    "serviceName": "RANGER",
+    "filename": "admin-properties.xml",
+    "category": "RangerSettings"
+  },
   {
     "id": "site property",
     "name": "ranger.unixauth.remote.login.enabled",

+ 1 - 1
ambari-web/app/messages.js

@@ -709,7 +709,7 @@ Em.I18n.translations = {
   'installer.step4.ambariMetricsCheck.popup.body':'Ambari Metrics collects metrics from the cluster and makes them available to Ambari.  If you do not install Ambari Metrics service, metrics will not be accessible from Ambari.  Are you sure you want to proceed without Ambari Metrics?',
   'installer.step4.rangerRequirements.popup.header': 'Ranger Requirements',
   'installer.step4.rangerRequirements.popup.body.requirements': '<ol><li>You must have an <strong>MySQL/Oracle/Postgres/MSSQL Server</strong> database instance running to be used by Ranger.</li>' +
-    '<li>In Assign Masters step of this wizard, you will be prompted to specify which host for the Ranger Admin. On that host, you <strong>must have DB Client installed</strong> for Ranger to access to the database. (Note: This is only applicable for only HDP 2.2)</li>' +
+    '<li>In Assign Masters step of this wizard, you will be prompted to specify which host for the Ranger Admin. On that host, you <strong>must have DB Client installed</strong> for Ranger to access to the database. (Note: This is only applicable for only Ranger 0.4.0)</li>' +
     '<li>Ensure that the access for the DB Admin user is enabled in DB server from any host.</li>' +
     '<li>Execute the following command on the Ambari Server host. Replace <code>database-type</code> with <strong>mysql|oracle|postgres|mssql</strong> and <code>/jdbc/driver/path</code> based on the location of corresponding JDBC driver:' +
     '<pre>ambari-server setup --jdbc-db={database-type} --jdbc-driver={/jdbc/driver/path}</pre></li></ol>',

+ 15 - 19
ambari-web/app/views/common/controls_view.js

@@ -422,11 +422,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     // so as to not lose the user's customizations on these fields
     if (['addServiceController', 'installerController'].contains(this.get('controller.wizardController.name'))) {
       if (/^New\s\w+\sDatabase$/.test(this.get('serviceConfig.value')) ||
-        this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name')) ||
-        this.get('serviceConfig.serviceName') === 'RANGER') {
+        this.get('dontUseHandleDbConnection').contains(this.get('serviceConfig.name'))) {
         this.onOptionsChange();
       } else {
-        if (App.get('isHadoopWindowsStack') && /SQL\sauthentication/.test(this.get('serviceConfig.value'))) {
+        if ((App.get('isHadoopWindowsStack') && /SQL\sauthentication/.test(this.get('serviceConfig.value'))) || this.get('serviceConfig.name') === 'DB_FLAVOR') {
           this.onOptionsChange();
         }
         this.handleDBConnectionProperty();
@@ -444,10 +443,10 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     // functionality added in HDP 2.3
     // remove DB_FLAVOR so it can handle DB Connection checks
     if (App.get('currentStackName') == 'HDP' && majorVersion >= 2  && minorVersion>= 3) {
-      return ['authentication_method'];
+      return ['ranger.authentication.method'];
     }
     return ['DB_FLAVOR', 'authentication_method'];
-  }.property(),
+  }.property('App.currentStackName'),
 
   configs: function () {
     if (this.get('controller.name') == 'mainServiceInfoConfigsController') return this.get('categoryConfigsAll');
@@ -577,9 +576,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
             break;
           case 'RANGER':
             var mysqlUrl = 'jdbc:mysql://{0}/{1}',
-              sqlCommand = 'mysql',
               sqlConnectorJARValue = '/usr/share/java/mysql-connector-java.jar',
-              sqlCommandInvoker = categoryConfigsAll.findProperty('name','SQL_COMMAND_INVOKER'),
               sqlConnectorJAR = this.get('parentView.serviceConfigs').findProperty('name', 'SQL_CONNECTOR_JAR'),
               dbFlavor = this.get('serviceConfig.value'),
               databasesTypes = /MYSQL|POSTGRES|ORACLE|MSSQL/gi,
@@ -590,7 +587,6 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
                 connectionUrlValue = oracleUrl.format(hostName, databaseName);
                 connectionUrlDefaultValue = oracleUrl.format(hostNameDefault, databaseNameDefault);
                 dbClassValue = 'oracle.jdbc.driver.OracleDriver';
-                sqlCommand = 'sqlplus';
                 sqlConnectorJARValue = '/usr/share/java/ojdbc6.jar';
                 break;
               case 'MYSQL':
@@ -603,21 +599,18 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
                 connectionUrlValue = postgresUrl.format(hostName, databaseName);
                 connectionUrlDefaultValue = postgresUrl.format(hostNameDefault, databaseNameDefault);
                 dbClassValue = 'org.postgresql.Driver';
-                sqlCommand = 'psql';
                 sqlConnectorJARValue = '/usr/share/java/postgresql.jar';
                 break;
               case 'MSSQL':
                 connectionUrlValue = mssqlUrl.format(hostName, databaseName);
                 connectionUrlDefaultValue = mssqlUrl.format(hostNameDefault, databaseNameDefault);
                 dbClassValue = 'com.microsoft.sqlserver.jdbc.SQLServerDriver';
-                sqlCommand = 'sqlcmd';
                 sqlConnectorJARValue = '/usr/share/java/sqljdbc4.jar';
                 break;
             }
             this.get('categoryConfigsAll').findProperty('name', 'db_host').set('value', this.get('hostNameProperty.value'));
             sqlConnectorJAR.set('value',sqlConnectorJARValue);
             sqlConnectorJAR.set('recommendedValue',sqlConnectorJARValue);
-            sqlCommandInvoker.set('value', sqlCommand);
             break;
         }
         connectionUrl.set('value', connectionUrlValue);
@@ -741,19 +734,19 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     var connectionUrlConfig = {
       'HIVE': 'javax.jdo.option.ConnectionURL',
       'OOZIE':'oozie.service.JPAService.jdbc.url',
-      'RANGER': 'ranger_jdbc_connection_url'
+      'RANGER': App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.url' : 'ranger_jdbc_connection_url'
     };
     return this.get('categoryConfigsAll').findProperty('name', connectionUrlConfig[this.get('serviceConfig.serviceName')]);
-  }.property('serviceConfig.serviceName'),
+  }.property('serviceConfig.serviceName', 'App.isHadoop23Stack'),
 
   dbClass: function () {
     var dbClassConfig = {
       'HIVE': 'javax.jdo.option.ConnectionDriverName',
       'OOZIE':'oozie.service.JPAService.jdbc.driver',
-      'RANGER': 'ranger_jdbc_driver'
+      'RANGER': App.get('isHadoop23Stack') ? 'ranger.jpa.jdbc.driver' : 'ranger_jdbc_driver'
     };
     return this.get('categoryConfigsAll').findProperty('name', dbClassConfig[this.get('serviceConfig.serviceName')]);
-  }.property('serviceConfig.serviceName'),
+  }.property('serviceConfig.serviceName', 'App.isHadoop23Stack'),
 
   /**
    * `Observer` that add <code>additionalView</code> to <code>App.ServiceConfigProperty</code>
@@ -782,7 +775,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     var propertyAppendTo2 = propertyHive ? propertyHive : propertyOozie;
     // RANGER specific
     if (this.get('serviceConfig.serviceName') === 'RANGER') {
-      propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('name', 'db_name');
+      propertyAppendTo1 = this.get('categoryConfigsAll').findProperty('name', 'ranger.jpa.jdbc.url');
       propertyAppendTo2 = this.get('categoryConfigsAll').findProperty('name', 'DB_FLAVOR');
       // check for all db types when installing Ranger - not only for existing ones
       checkDatabase = true;
@@ -792,7 +785,9 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
     if (currentDB && checkDatabase) {
       if (handledProperties.contains(this.get('serviceConfig.name'))) {
         if (propertyAppendTo1) {
-          propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
+          Em.run.next(function(){
+            propertyAppendTo1.set('additionalView', App.CheckDBConnectionView.extend({databaseName: currentDB}));
+          });
         }
         if (propertyAppendTo2) {
           propertyAppendTo2.set('additionalView', Ember.View.extend({
@@ -1212,10 +1207,11 @@ App.CheckDBConnectionView = Ember.View.extend({
       OOZIE: ['oozie.db.schema.name', 'oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password', 'oozie.service.JPAService.jdbc.driver', 'oozie.service.JPAService.jdbc.url'],
       HIVE: ['ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword', 'javax.jdo.option.ConnectionDriverName', 'javax.jdo.option.ConnectionURL'],
       KERBEROS: ['kdc_host'],
-      RANGER: ['db_root_user', 'db_root_password', 'db_name', 'ranger_jdbc_connection_url', 'ranger_jdbc_driver']
+      RANGER: App.get('isHadoop23Stack') ? ['db_root_user', 'db_root_password', 'db_name', 'ranger.jpa.jdbc.url', 'ranger.jpa.jdbc.driver'] :
+          ['db_root_user', 'db_root_password', 'db_name', 'ranger_jdbc_connection_url', 'ranger_jdbc_driver']
     };
     return propertiesMap[this.get('parentView.service.serviceName')];
-  }.property(),
+  }.property('App.isHadoop23Stack'),
   /** @property {Object} propertiesPattern - check pattern according to type of connection properties **/
   propertiesPattern: function() {
     var patterns = {