step9_controller.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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', 'startAllServices', 'deleteSNameNode'],
  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.startComponent('NAMENODE', hostName);
  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);
  45. },
  46. startZKFC: function () {
  47. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  48. this.startComponent('ZKFC', hostName);
  49. },
  50. reconfigureHBase: function () {
  51. this.loadConfigsTags();
  52. },
  53. loadConfigsTags: function () {
  54. App.ajax.send({
  55. name: 'config.tags',
  56. sender: this,
  57. success: 'onLoadConfigsTags',
  58. error: 'onTaskError'
  59. });
  60. },
  61. onLoadConfigsTags: function (data) {
  62. var hbaseSiteTag = data.Clusters.desired_configs['hbase-site'].tag;
  63. this.set("hbaseSiteTag", {name : "hbaseSiteTag", value : hbaseSiteTag});
  64. App.ajax.send({
  65. name: 'admin.high_availability.load_hbase_configs',
  66. sender: this,
  67. data: {
  68. hbaseSiteTag: hbaseSiteTag
  69. },
  70. success: 'onLoadConfigs',
  71. error: 'onTaskError'
  72. });
  73. },
  74. onLoadConfigs: function (data) {
  75. var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
  76. var nameServiceId = this.get('content.nameServiceId');
  77. //hbase-site configs changes
  78. hbaseSiteProperties['hbase.rootdir'] = hbaseSiteProperties['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + nameServiceId);
  79. App.ajax.send({
  80. name: 'admin.high_availability.save_configs',
  81. sender: this,
  82. data: {
  83. siteName: 'hbase-site',
  84. properties: hbaseSiteProperties
  85. },
  86. success: 'saveConfigTag',
  87. error: 'onTaskError'
  88. });
  89. },
  90. saveConfigTag: function () {
  91. App.router.get(this.get('content.controllerName')).saveConfigTag(this.get("hbaseSiteTag"));
  92. App.clusterStatus.setClusterStatus({
  93. clusterName: this.get('content.cluster.name'),
  94. clusterState: 'HIGH_AVAILABILITY_DEPLOY',
  95. wizardControllerName: this.get('content.controllerName'),
  96. localdb: App.db.data
  97. });
  98. this.onTaskCompleted();
  99. },
  100. startAllServices: function () {
  101. App.ajax.send({
  102. name: 'admin.high_availability.start_all_services',
  103. sender: this,
  104. success: 'startPolling',
  105. error: 'onTaskError'
  106. });
  107. },
  108. deleteSNameNode: function () {
  109. var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
  110. App.ajax.send({
  111. name: 'admin.high_availability.delete_component',
  112. sender: this,
  113. data: {
  114. componentName: 'SECONDARY_NAMENODE',
  115. hostName: hostName
  116. },
  117. success: 'onTaskCompleted',
  118. error: 'onTaskError'
  119. });
  120. }
  121. });