浏览代码

AMBARI-10420 Configure Accumulo in the HA wizard (billie)

Billie Rinaldi 10 年之前
父节点
当前提交
ee13537090

+ 34 - 0
ambari-web/app/controllers/main/admin/highAvailability/nameNode/rollback_controller.js

@@ -33,6 +33,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
   commands: [
     'stopAllServices',
     'restoreHBaseConfigs',
+    'restoreAccumuloConfigs',
     'stopFailoverControllers',
     'deleteFailoverControllers',
     'stopStandbyNameNode',
@@ -68,6 +69,7 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       'deleteSNameNode',
       'startAllServices',
       'reconfigureHBase',
+      'reconfigureAccumulo',
       'startZKFC',
       'installZKFC',
       'startSecondNameNode',
@@ -95,6 +97,10 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
     if (!App.Service.find().someProperty('serviceName', 'HBASE') && hbaseTask) {
       this.get('tasks').splice(hbaseTask.get('id'), 1);
     }
+    var accumuloTask = this.get('tasks').findProperty('command', 'restoreAccumuloConfigs');
+    if (!App.Service.find().someProperty('serviceName', 'ACCUMULO') && accumuloTask) {
+      this.get('tasks').splice(accumuloTask.get('id'), 1);
+    }
   },
 
   clearStep: function () {
@@ -234,6 +240,20 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       error: 'onTaskError'
     });
   },
+  restoreAccumuloConfigs: function(){
+    console.warn('func: restoreAccumuloConfigs');
+    this.loadConfigTag("accumuloSiteTag");
+    var accumuloSiteTag = this.get("content.accumuloSiteTag");
+    App.ajax.send({
+      name: 'admin.high_availability.load_accumulo_configs',
+      sender: this,
+      data: {
+        accumuloSiteTag: accumuloSiteTag
+      },
+      success: 'onLoadAccumuloConfigs',
+      error: 'onTaskError'
+    });
+  },
 
   stopFailoverControllers: function(){
     console.warn('func: stopFailoverControllers');
@@ -309,6 +329,20 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl
       error: 'onTaskError'
     });
   },
+  onLoadAccumuloConfigs: function (data) {
+    console.warn('func: onLoadAccumuloConfigs');
+    var accumuloSiteProperties = data.items.findProperty('type', 'accumulo-site').properties;
+    App.ajax.send({
+      name: 'admin.high_availability.save_configs',
+      sender: this,
+      data: {
+        siteName: 'accumulo-site',
+        properties: accumuloSiteProperties
+      },
+      success: 'onTaskCompleted',
+      error: 'onTaskError'
+    });
+  },
 
   onDeletedHDFSClient: function () {
     console.warn('func: onDeletedHDFSClient');

+ 14 - 0
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js

@@ -71,6 +71,11 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
       urlParams.push('(type=hbase-site&tag=' + hbaseSiteTag + ')');
       this.set("hbaseSiteTag", {name : "hbaseSiteTag", value : hbaseSiteTag});
     }
+    if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
+      var accumuloSiteTag = data.Clusters.desired_configs['accumulo-site'].tag;
+      urlParams.push('(type=accumulo-site&tag=' + accumuloSiteTag + ')');
+      this.set("accumuloSiteTag", {name : "accumuloSiteTag", value : accumuloSiteTag});
+    }
     App.ajax.send({
       name: 'admin.get.all_configurations',
       sender: this,
@@ -137,6 +142,15 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
      var value = this.get('serverConfigData.items').findProperty('type', 'hbase-site').properties['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + nameServiceId);
      this.setConfigInitialValue(config,value);
     }
+    config = configs.findProperty('name','instance.volumes');
+    var config2 = configs.findProperty('name','instance.volumes.replacements');
+    if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
+      var oldValue = this.get('serverConfigData.items').findProperty('type', 'accumulo-site').properties['instance.volumes'];
+      var value = oldValue.replace(/\/\/[^\/]*/, '//' + nameServiceId);
+      var replacements = oldValue + " " + value;
+      this.setConfigInitialValue(config,value);
+      this.setConfigInitialValue(config2,replacements)
+    }
     config = configs.findProperty('name','dfs.journalnode.edits.dir');
     if (App.get('isHadoopWindowsStack') && App.Service.find().someProperty('serviceName', 'HDFS')) {
      var value = this.get('serverConfigData.items').findProperty('type', 'hdfs-site').properties['dfs.journalnode.edits.dir'];

+ 21 - 1
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js

@@ -22,14 +22,20 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
 
   name:"highAvailabilityWizardStep9Controller",
 
-  commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'deleteSNameNode', 'startAllServices'],
+  commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'reconfigureAccumulo', 'deleteSNameNode', 'startAllServices'],
 
   hbaseSiteTag: "",
+  accumuloSiteTag: "",
 
   initializeTasks: function () {
     this._super();
+    var numSpliced = 0;
     if (!App.Service.find().someProperty('serviceName', 'HBASE')) {
       this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHBase').get('id'), 1);
+      numSpliced = 1;
+    }
+    if (!App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
+      this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureAccumulo').get('id') - numSpliced, 1);
     }
   },
 
@@ -71,6 +77,20 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
     });
   },
 
+  reconfigureAccumulo: function () {
+    var data = this.get('content.serviceConfigProperties');
+    var configData = this.reconfigureSites(['accumulo-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
+    App.ajax.send({
+      name: 'common.service.configurations',
+      sender: this,
+      data: {
+        desired_config: configData
+      },
+      success: 'saveConfigTag',
+      error: 'onTaskError'
+    });
+  },
+
   saveConfigTag: function () {
     App.clusterStatus.setClusterStatus({
       clusterName: this.get('content.cluster.name'),

+ 9 - 0
ambari-web/app/controllers/wizard/step7_controller.js

@@ -769,6 +769,15 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
             'recommendedValue' : valueToChange
           });
         }
+        if(this.get('selectedServiceNames').contains('ACCUMULO') && nameServiceId){
+          var vols = serviceConfigs.findProperty('serviceName', 'ACCUMULO').configs.findProperty('name','instance.volumes'),
+            valueToChange = vols.get('value').replace(/\/\/.*:[0-9]+/i, '//' + nameServiceId.get('value'));
+
+          vols.setProperties({
+            'value':  valueToChange,
+            'recommendedValue' : valueToChange
+          });
+        }
       }
     }
 

+ 25 - 2
ambari-web/app/data/HDP2/ha_properties.js

@@ -23,9 +23,10 @@ module.exports =
     displayName: 'MISC',
     configCategories: [
       App.ServiceConfigCategory.create({ name: 'HDFS', displayName: 'HDFS'}),
-      App.ServiceConfigCategory.create({ name: 'HBASE', displayName: 'HBase'})
+      App.ServiceConfigCategory.create({ name: 'HBASE', displayName: 'HBase'}),
+      App.ServiceConfigCategory.create({ name: 'ACCUMULO', displayName: 'Accumulo'})
     ],
-    sites: ['core-site', 'hdfs-site','hbase-site'],
+    sites: ['core-site', 'hdfs-site', 'hbase-site', 'accumulo-site'],
     configs: [
     /**********************************************HDFS***************************************/
       {
@@ -234,6 +235,28 @@ module.exports =
         "category": "HBASE",
         "filename": "hbase-site",
         "serviceName": 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "instance.volumes",
+        "displayName": "instance.volumes",
+        "isReconfigurable": false,
+        "recommendedValue": "/hadoop/hdfs/journal",
+        "value": "/hadoop/hdfs/journal",
+        "category": "ACCUMULO",
+        "filename": "accumulo-site",
+        "serviceName": 'MISC'
+      },
+      {
+        "id": "site property",
+        "name": "instance.volumes.replacements",
+        "displayName": "instance.volumes.replacements",
+        "isReconfigurable": false,
+        "recommendedValue": "/hadoop/hdfs/journal",
+        "value": "/hadoop/hdfs/journal",
+        "category": "ACCUMULO",
+        "filename": "accumulo-site",
+        "serviceName": 'MISC'
       }
     ]
   }

+ 3 - 2
ambari-web/app/messages.js

@@ -1131,8 +1131,9 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step9.task1.title':'Install Failover Controllers',
   'admin.highAvailability.wizard.step9.task2.title':'Start Failover Controllers',
   'admin.highAvailability.wizard.step9.task3.title':'Reconfigure HBase',
-  'admin.highAvailability.wizard.step9.task4.title':'Delete Secondary NameNode',
-  'admin.highAvailability.wizard.step9.task5.title':'Start All Services',
+  'admin.highAvailability.wizard.step9.task4.title':'Reconfigure Accumulo',
+  'admin.highAvailability.wizard.step9.task5.title':'Delete Secondary NameNode',
+  'admin.highAvailability.wizard.step9.task6.title':'Start All Services',
   'admin.highAvailability.wizard.step9.notice.completed':'NameNode HA has been enabled successfully.',
 
   'admin.highAvailability.wizard.step3.curNameNode': '<b>Current NameNode:</b> ',