step9_controller.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageController.extend({
  20. name:"highAvailabilityWizardStep9Controller",
  21. isHA: true,
  22. commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'deleteSNameNode', 'startAllServices'],
  23. hbaseSiteTag: "",
  24. initializeTasks: function () {
  25. this._super();
  26. if (!App.Service.find().someProperty('serviceName', 'HBASE')) {
  27. this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHBase').get('id'), 1);
  28. }
  29. },
  30. startSecondNameNode: function () {
  31. var hostName = this.get('content.masterComponentHosts').findProperty('isAddNameNode', true).hostName;
  32. this.updateComponent('NAMENODE', hostName, "HDFS", "Start");
  33. },
  34. installZKFC: function () {
  35. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  36. this.createComponent('ZKFC', hostName, "HDFS");
  37. },
  38. startZKFC: function () {
  39. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  40. this.updateComponent('ZKFC', hostName, "HDFS", "Start");
  41. },
  42. reconfigureHBase: function () {
  43. var data = this.get('content.serviceConfigProperties');
  44. var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
  45. App.ajax.send({
  46. name: 'admin.high_availability.save_configs',
  47. sender: this,
  48. data: {
  49. siteName: 'hbase-site',
  50. properties: hbaseSiteProperties
  51. },
  52. success: 'saveConfigTag',
  53. error: 'onTaskError'
  54. });
  55. },
  56. saveConfigTag: function () {
  57. App.clusterStatus.setClusterStatus({
  58. clusterName: this.get('content.cluster.name'),
  59. clusterState: 'HIGH_AVAILABILITY_DEPLOY',
  60. wizardControllerName: this.get('content.controllerName'),
  61. localdb: App.db.data
  62. });
  63. this.onTaskCompleted();
  64. },
  65. startAllServices: function () {
  66. App.ajax.send({
  67. name: 'common.services.update',
  68. data: {
  69. context: "Start all services",
  70. "ServiceInfo": {
  71. "state": "STARTED"
  72. }
  73. },
  74. sender: this,
  75. success: 'startPolling',
  76. error: 'onTaskError'
  77. });
  78. },
  79. deleteSNameNode: function () {
  80. var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
  81. App.ajax.send({
  82. name: 'common.delete.host_component',
  83. sender: this,
  84. data: {
  85. componentName: 'SECONDARY_NAMENODE',
  86. hostName: hostName
  87. },
  88. success: 'onTaskCompleted',
  89. error: 'onTaskError'
  90. });
  91. }
  92. });