step9_controller.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'reconfigureHBase', 'startAllServices', 'deleteSNameNode'],
  22. clearStep: function () {
  23. this._super();
  24. if (!App.Service.find().someProperty('serviceName', 'HBASE')) {
  25. this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHBase').get('id'), 1);
  26. }
  27. },
  28. startSecondNameNode: function () {
  29. var hostName = this.get('content.masterComponentHosts').findProperty('isAddNameNode', true).hostName;
  30. this.startComponent('NAMENODE', hostName);
  31. },
  32. installZKFC: function () {
  33. App.ajax.send({
  34. name: 'admin.high_availability.create_zkfc',
  35. sender: this,
  36. success: 'onZKFCCreate',
  37. error: 'onZKFCCreate'
  38. });
  39. },
  40. onZKFCCreate: function () {
  41. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  42. this.createComponent('ZKFC', hostName);
  43. },
  44. startZKFC: function () {
  45. var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  46. this.startComponent('ZKFC', hostName);
  47. },
  48. reconfigureHBase: function () {
  49. this.loadConfigsTags();
  50. },
  51. loadConfigsTags: function () {
  52. App.ajax.send({
  53. name: 'config.tags',
  54. sender: this,
  55. success: 'onLoadConfigsTags',
  56. error: 'onTaskError'
  57. });
  58. },
  59. onLoadConfigsTags: function (data) {
  60. var hbaseSiteTag = data.Clusters.desired_configs['hbase-site'].tag;
  61. App.ajax.send({
  62. name: 'admin.high_availability.load_hbase_configs',
  63. sender: this,
  64. data: {
  65. hbaseSiteTag: hbaseSiteTag
  66. },
  67. success: 'onLoadConfigs',
  68. error: 'onTaskError'
  69. });
  70. },
  71. onLoadConfigs: function (data) {
  72. var hbaseSiteProperties = data.items.findProperty('type', 'hbase-site').properties;
  73. var nameServiceId = this.get('content.nameServiceId');
  74. //hbase-site configs changes
  75. hbaseSiteProperties['hbase.rootdir'] = hbaseSiteProperties['hbase.rootdir'].replace(/\/\/[^\/]*/, '//' + nameServiceId);
  76. App.ajax.send({
  77. name: 'admin.high_availability.save_configs',
  78. sender: this,
  79. data: {
  80. siteName: 'hbase-site',
  81. properties: hbaseSiteProperties
  82. },
  83. success: 'onTaskCompleted',
  84. error: 'onTaskError'
  85. });
  86. },
  87. startAllServices: function () {
  88. App.ajax.send({
  89. name: 'admin.high_availability.start_all_services',
  90. sender: this,
  91. success: 'startPolling',
  92. error: 'onTaskError'
  93. });
  94. },
  95. deleteSNameNode: function () {
  96. var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
  97. App.ajax.send({
  98. name: 'admin.high_availability.delete_snamenode',
  99. sender: this,
  100. data: {
  101. hostName: hostName
  102. },
  103. success: 'onTaskCompleted',
  104. error: 'onTaskError'
  105. });
  106. }
  107. });