step5_controller.js 4.1 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.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageController.extend({
  20. name:"highAvailabilityWizardStep5Controller",
  21. isHA: true,
  22. commands: ['stopAllServices', 'installNameNode', 'installJournalNodes', 'reconfigureHDFS', 'startJournalNodes', 'disableSNameNode'],
  23. hdfsSiteTag : "",
  24. coreSiteTag : "",
  25. stopAllServices: function () {
  26. App.ajax.send({
  27. name: 'common.services.update',
  28. data: {
  29. context: "Stop all services",
  30. "ServiceInfo": {
  31. "state": "INSTALLED"
  32. }
  33. },
  34. sender: this,
  35. success: 'startPolling',
  36. error: 'onTaskError'
  37. });
  38. },
  39. installNameNode: function () {
  40. var hostName = this.get('content.masterComponentHosts').findProperty('isAddNameNode').hostName;
  41. this.createComponent('NAMENODE', hostName, "HDFS");
  42. },
  43. installJournalNodes: function () {
  44. var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
  45. this.createComponent('JOURNALNODE', hostNames, "HDFS");
  46. },
  47. startJournalNodes: function () {
  48. var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
  49. this.updateComponent('JOURNALNODE', hostNames, "HDFS", "Start");
  50. },
  51. disableSNameNode: function () {
  52. var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
  53. App.ajax.send({
  54. name: 'common.host.host_component.passive',
  55. sender: this,
  56. data: {
  57. hostName: hostName,
  58. passive_state: "ON",
  59. componentName: 'SECONDARY_NAMENODE'
  60. },
  61. success: 'onTaskCompleted',
  62. error: 'onTaskError'
  63. });
  64. },
  65. reconfigureHDFS: function () {
  66. var data = this.get('content.serviceConfigProperties');
  67. var hdfsSiteProperties = data.items.findProperty('type', 'hdfs-site').properties;
  68. var coreSiteProperties = data.items.findProperty('type', 'core-site').properties;
  69. var self = this;
  70. App.ajax.send({
  71. name: 'admin.high_availability.save_configs',
  72. sender: this,
  73. data: {
  74. siteName: 'hdfs-site',
  75. properties: hdfsSiteProperties
  76. },
  77. error: 'onTaskError'
  78. }).done(function() {
  79. App.ajax.send({
  80. name: 'admin.high_availability.save_configs',
  81. sender: self,
  82. data: {
  83. siteName: 'core-site',
  84. properties: coreSiteProperties
  85. },
  86. error: 'onTaskError',
  87. success: 'installHDFSClients'
  88. });
  89. });
  90. },
  91. installHDFSClients: function () {
  92. var nnHostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
  93. var jnHostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
  94. var hostNames = nnHostNames.concat(jnHostNames).uniq();
  95. this.createComponent('HDFS_CLIENT', hostNames);
  96. App.router.get(this.get('content.controllerName')).saveHdfsClientHosts(hostNames);
  97. App.clusterStatus.setClusterStatus({
  98. clusterName: this.get('content.cluster.name'),
  99. clusterState: 'HIGH_AVAILABILITY_DEPLOY',
  100. wizardControllerName: this.get('content.controllerName'),
  101. localdb: App.db.data
  102. });
  103. }
  104. });