step9_controller.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. App.ajax.send({
  36. name: 'admin.high_availability.create_zkfc',
  37. sender: this,
  38. success: 'onZKFCCreate',
  39. error: 'onZKFCCreate'
  40. });
  41. },
  42. onZKFCCreate: function () {
  43. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  44. this.createComponent('ZKFC', hostName, "HDFS");
  45. },
  46. startZKFC: function () {
  47. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  48. this.updateComponent('ZKFC', hostName, "HDFS", "Start");
  49. },
  50. reconfigureHBase: function () {
  51. var data = this.get('content.serviceConfigProperties');
  52. var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
  53. App.ajax.send({
  54. name: 'admin.high_availability.save_configs',
  55. sender: this,
  56. data: {
  57. siteName: 'hbase-site',
  58. properties: hbaseSiteProperties
  59. },
  60. success: 'saveConfigTag',
  61. error: 'onTaskError'
  62. });
  63. },
  64. saveConfigTag: function () {
  65. App.clusterStatus.setClusterStatus({
  66. clusterName: this.get('content.cluster.name'),
  67. clusterState: 'HIGH_AVAILABILITY_DEPLOY',
  68. wizardControllerName: this.get('content.controllerName'),
  69. localdb: App.db.data
  70. });
  71. this.onTaskCompleted();
  72. },
  73. startAllServices: function () {
  74. App.ajax.send({
  75. name: 'common.services.update',
  76. data: {
  77. context: "Start all services",
  78. "ServiceInfo": {
  79. "state": "STARTED"
  80. }
  81. },
  82. sender: this,
  83. success: 'startPolling',
  84. error: 'onTaskError'
  85. });
  86. },
  87. deleteSNameNode: function () {
  88. var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
  89. App.ajax.send({
  90. name: 'common.delete.host_component',
  91. sender: this,
  92. data: {
  93. componentName: 'SECONDARY_NAMENODE',
  94. hostName: hostName
  95. },
  96. success: 'onTaskCompleted',
  97. error: 'onTaskError'
  98. });
  99. }
  100. });