浏览代码

AMBARI-2846. NameNode HA Wizard: "Initialize Metadata" page. (Antonenko Alexander via yusaku)

Yusaku Sako 12 年之前
父节点
当前提交
73ba823aeb

+ 1 - 0
ambari-web/app/controllers.js

@@ -36,6 +36,7 @@ require('controllers/main/admin/highAvailability/step4_controller');
 require('controllers/main/admin/highAvailability/step5_controller');
 require('controllers/main/admin/highAvailability/step5_controller');
 require('controllers/main/admin/highAvailability/step6_controller');
 require('controllers/main/admin/highAvailability/step6_controller');
 require('controllers/main/admin/highAvailability/step7_controller');
 require('controllers/main/admin/highAvailability/step7_controller');
+require('controllers/main/admin/highAvailability/step8_controller');
 require('controllers/main/admin/cluster');
 require('controllers/main/admin/cluster');
 require('controllers/main/admin/stack_upgrade_controller');
 require('controllers/main/admin/stack_upgrade_controller');
 require('controllers/main/admin/user');
 require('controllers/main/admin/user');

+ 1 - 3
ambari-web/app/controllers/main/admin/highAvailability/step6_controller.js

@@ -18,9 +18,7 @@
 
 
 var App = require('app');
 var App = require('app');
 
 
-require('controllers/main/admin/misc_controller');
-
-App.HighAvailabilityWizardStep6Controller = App.MainAdminMiscController.extend({
+App.HighAvailabilityWizardStep6Controller = Em.Controller.extend({
 
 
   name:"highAvailabilityWizardStep6Controller"
   name:"highAvailabilityWizardStep6Controller"
 
 

+ 26 - 0
ambari-web/app/controllers/main/admin/highAvailability/step8_controller.js

@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.HighAvailabilityWizardStep8Controller = Em.Controller.extend({
+
+  name:"highAvailabilityWizardStep8Controller"
+
+})
+

+ 2 - 1
ambari-web/app/controllers/main/admin/highAvailability/wizard_controller.js

@@ -23,7 +23,7 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
 
 
   name: 'highAvailabilityWizardController',
   name: 'highAvailabilityWizardController',
 
 
-  totalSteps: 7,
+  totalSteps: 8,
 
 
   /**
   /**
    * Used for hiding back button in wizard
    * Used for hiding back button in wizard
@@ -165,6 +165,7 @@ App.HighAvailabilityWizardController = App.WizardController.extend({
   loadAllPriorSteps: function () {
   loadAllPriorSteps: function () {
     var step = this.get('currentStep');
     var step = this.get('currentStep');
     switch (step) {
     switch (step) {
+      case '8':
       case '7':
       case '7':
       case '6':
       case '6':
       case '5':
       case '5':

+ 23 - 12
ambari-web/app/messages.js

@@ -647,9 +647,12 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step2.header':'Select Hosts',
   'admin.highAvailability.wizard.step2.header':'Select Hosts',
   'admin.highAvailability.wizard.step3.header':'Review',
   'admin.highAvailability.wizard.step3.header':'Review',
   'admin.highAvailability.wizard.step4.header':'Create Checkpoint',
   'admin.highAvailability.wizard.step4.header':'Create Checkpoint',
+  'admin.highAvailability.wizard.step6.header':'Initialize JournalNodes',
+  'admin.highAvailability.wizard.step8.header':'Initialize Metadata',
   'admin.highAvailability.wizard.step4.bodyHeader':'Manual Steps Required: Create Checkpoint on NameNode',
   'admin.highAvailability.wizard.step4.bodyHeader':'Manual Steps Required: Create Checkpoint on NameNode',
   'admin.highAvailability.wizard.step6.bodyHeader':'Manual Steps Required: Initialize JournalNodes',
   'admin.highAvailability.wizard.step6.bodyHeader':'Manual Steps Required: Initialize JournalNodes',
-  'admin.highAvailability.wizard.step6.header':'Initialize JournalNodes',
+  'admin.highAvailability.wizard.step8.bodyHeader':'Manual Steps Required: Initialize NameNode HA Metadata',
+
 
 
   'admin.highAvailability.wizard.step5.task0.title':'Stop all services',
   'admin.highAvailability.wizard.step5.task0.title':'Stop all services',
   'admin.highAvailability.wizard.step5.task1.title':'Install Additional NameNode',
   'admin.highAvailability.wizard.step5.task1.title':'Install Additional NameNode',
@@ -667,17 +670,25 @@ Em.I18n.translations = {
   'admin.highAvailability.wizard.step3.jn':'JournalNode will be installed on following hosts:',
   'admin.highAvailability.wizard.step3.jn':'JournalNode will be installed on following hosts:',
   'admin.highAvailability.wizard.step4.ckNotCreated':'Checkpoint not created yet',
   'admin.highAvailability.wizard.step4.ckNotCreated':'Checkpoint not created yet',
   'admin.highAvailability.wizard.step6.jsNoInit':'JournalNodes not initialized yet',
   'admin.highAvailability.wizard.step6.jsNoInit':'JournalNodes not initialized yet',
-
-
-  'admin.highAvailability.wizard.step6.body':'Note: The following commands must be run as the user {0} on {1} <br/>' +
-    '1. Initialize the JournalNodes by running: <br/>' +
-    '$ hdfs namenode -initializeSharedEdits<br/>' +
-    '2. You will be able to proceed to the next step once we detect that the JournalNodes have been initialized successfuly.<br/>',
-  'admin.highAvailability.wizard.step4.body':'Note: The following commands must be run as the user {0} on {1} <br/>' +
-    '1. Put the NameNode in safe mode (read-only-mode) by running: <br/>' +
-    '$ hdfs dfsadmin -safemode enter <br/>' +
-    '2. Once NameNode is in Safe Mode, create a checkpoint by running: <br/>' +
-    '$ TDB COMMAND <br/>' +
+  'admin.highAvailability.wizard.step8.metaNoInit':'Metadata not initialized yet',
+
+
+  'admin.highAvailability.wizard.step8.body':'Note: The following command must be run as the user {0} on {2}, not {1} <br/><br/>' +
+    '1. Initialize the metadata for additional NameNode by running: <br/><br/>' +
+    '$ hdfs namenode -bootstrapStandby<br/><br/>' +
+    'Note: The following command must be run as the user {0} on {1}, not {2} <br/><br/>' +
+    '2. Initialize the metadata for NameNode automatic failover by running:<br/>' +
+    '$ hdfs -zkfc formatZK<br/><br/>' +
+    '3. You will be able to proceed to the next step once we detect that the steps were completed successfully.',
+  'admin.highAvailability.wizard.step6.body':'Note: The following commands must be run as the user {0} on {1} <br/><br/>' +
+    '1. Initialize the JournalNodes by running: <br/><br/>' +
+    '$ hdfs namenode -initializeSharedEdits<br/><br/>' +
+    '2. You will be able to proceed to the next step once we detect that the JournalNodes have been initialized successfully.',
+  'admin.highAvailability.wizard.step4.body':'Note: The following commands must be run as the user {0} on {1} <br/><br/>' +
+    '1. Put the NameNode in safe mode (read-only-mode) by running: <br/><br/>' +
+    '$ hdfs dfsadmin -safemode enter <br/><br/>' +
+    '2. Once NameNode is in Safe Mode, create a checkpoint by running: <br/><br/>' +
+    '$ TDB COMMAND <br/><br/>' +
     '3. You will be able to proceed to the next step once we detect that the NameNode is in Safe Mode and that the checkpoint has been created successfully.',
     '3. You will be able to proceed to the next step once we detect that the NameNode is in Safe Mode and that the checkpoint has been created successfully.',
   'admin.highAvailability.wizard.step3.body':'Confirm your host selection and click Deploy to activate NameNode HA.',
   'admin.highAvailability.wizard.step3.body':'Confirm your host selection and click Deploy to activate NameNode HA.',
   'admin.highAvailability.wizard.step2.body':'Select a host that will be running an additional NameNode.<br/> In addition,' +
   'admin.highAvailability.wizard.step2.body':'Select a host that will be running an additional NameNode.<br/> In addition,' +

+ 24 - 1
ambari-web/app/routes/high_availability_routes.js

@@ -170,6 +170,27 @@ module.exports = Em.Route.extend({
       router.transitionTo('step6');
       router.transitionTo('step6');
     },
     },
     next: function (router) {
     next: function (router) {
+      router.transitionTo('step8');
+    }
+  }),
+
+  step8: Em.Route.extend({
+    route: '/step8',
+    connectOutlets: function (router) {
+      $('a.close').hide();
+      var controller = router.get('highAvailabilityWizardController');
+      controller.setCurrentStep('8');
+      controller.setLowerStepsDisable(8);
+      controller.dataLoading().done(function () {
+        controller.loadAllPriorSteps();
+        controller.connectOutlet('highAvailabilityWizardStep8',  controller.get('content'));
+      })
+    },
+    back: function (router) {
+      router.transitionTo('step7');
+    },
+    next: function (router) {
+      router.transitionTo('step9');
     }
     }
   }),
   }),
 
 
@@ -185,5 +206,7 @@ module.exports = Em.Route.extend({
 
 
   gotoStep6: Em.Router.transitionTo('step6'),
   gotoStep6: Em.Router.transitionTo('step6'),
 
 
-  gotoStep7: Em.Router.transitionTo('step7')
+  gotoStep7: Em.Router.transitionTo('step7'),
+
+  gotoStep8: Em.Router.transitionTo('step8')
 });
 });

+ 27 - 0
ambari-web/app/templates/main/admin/highAvailability/step8.hbs

@@ -0,0 +1,27 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+<div>
+  <h2>{{t admin.highAvailability.wizard.step8.bodyHeader}}</h2>
+  <p class="alert alert-info">
+    {{{view.step8BodyText}}}
+  </p>
+  <div class="btn-area">
+    <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} &rarr;</a>
+    <span class="pull-right btn-extra-info">{{t admin.highAvailability.wizard.step8.metaNoInit}}</span>
+  </div>
+</div>

+ 1 - 0
ambari-web/app/templates/main/admin/highAvailability/wizard.hbs

@@ -32,6 +32,7 @@
               <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep5 target="controller"}}>{{t admin.highAvailability.wizard.progressPage.header}}</a></li>
               <li {{bindAttr class="isStep5:active view.isStep5Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep5 target="controller"}}>{{t admin.highAvailability.wizard.progressPage.header}}</a></li>
               <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep6 target="controller"}}>{{t admin.highAvailability.wizard.step6.header}}</a></li>
               <li {{bindAttr class="isStep6:active view.isStep6Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep6 target="controller"}}>{{t admin.highAvailability.wizard.step6.header}}</a></li>
               <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep7 target="controller"}}>{{t admin.highAvailability.wizard.progressPage.header}}</a></li>
               <li {{bindAttr class="isStep7:active view.isStep7Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep7 target="controller"}}>{{t admin.highAvailability.wizard.progressPage.header}}</a></li>
+              <li {{bindAttr class="isStep8:active view.isStep8Disabled:disabled"}}><a href="javascript:void(null);"  {{action gotoStep8 target="controller"}}>{{t admin.highAvailability.wizard.step8.header}}</a></li>
             </ul>
             </ul>
           </div>
           </div>
         </div>
         </div>

+ 2 - 2
ambari-web/app/utils/ajax.js

@@ -646,11 +646,11 @@ var urls = {
     'type': 'PUT',
     'type': 'PUT',
     'format': function () {
     'format': function () {
       return {
       return {
-        data: {
+        data: JSON.stringify({
           "HostRoles": {
           "HostRoles": {
             "state": "MAINTENANCE"
             "state": "MAINTENANCE"
           }
           }
-        }
+        })
       }
       }
     }
     }
   },
   },

+ 1 - 0
ambari-web/app/views.js

@@ -63,6 +63,7 @@ require('views/main/admin/highAvailability/step4_view');
 require('views/main/admin/highAvailability/step5_view');
 require('views/main/admin/highAvailability/step5_view');
 require('views/main/admin/highAvailability/step6_view');
 require('views/main/admin/highAvailability/step6_view');
 require('views/main/admin/highAvailability/step7_view');
 require('views/main/admin/highAvailability/step7_view');
+require('views/main/admin/highAvailability/step8_view');
 require('views/main/admin/cluster');
 require('views/main/admin/cluster');
 require('views/main/admin/misc_view');
 require('views/main/admin/misc_view');
 require('views/main/admin/stack_upgrade');
 require('views/main/admin/stack_upgrade');

+ 32 - 0
ambari-web/app/views/main/admin/highAvailability/step8_view.js

@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+var App = require('app');
+
+App.HighAvailabilityWizardStep8View = Em.View.extend({
+
+  templateName: require('templates/main/admin/highAvailability/step8'),
+
+  step8BodyText: function () {
+    var nN = this.get('controller.content.masterComponentHosts').findProperty('isCurNameNode', true);
+    var addNN = this.get('controller.content.masterComponentHosts').findProperty('isAddNameNode', true);
+    return Em.I18n.t('admin.highAvailability.wizard.step8.body').format(this.get('controller.content.hdfsUser'), nN.hostName, addNN.hostName);
+  }.property('controller.content.masterComponentHosts')
+
+});

+ 3 - 0
ambari-web/app/views/main/admin/highAvailability/wizard_view.js

@@ -51,6 +51,9 @@ App.HighAvailabilityWizardView = Em.View.extend({
     return this.isStepDisabled(7);
     return this.isStepDisabled(7);
   }.property('controller.isStepDisabled.@each.value').cacheable(),
   }.property('controller.isStepDisabled.@each.value').cacheable(),
 
 
+  isStep8Disabled: function () {
+    return this.isStepDisabled(8);
+  }.property('controller.isStepDisabled.@each.value').cacheable(),
 
 
   isStepDisabled: function (index) {
   isStepDisabled: function (index) {
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
     return this.get('controller.isStepDisabled').findProperty('step', index).get('value');