123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var App = require('app');
- App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
- name:"highAvailabilityWizardStep9Controller",
- commands: ['startSecondNameNode', 'installZKFC', 'startZKFC', 'installPXF', 'reconfigureHBase', 'reconfigureAccumulo', 'reconfigureHawq', 'deleteSNameNode', 'startAllServices'],
- hbaseSiteTag: "",
- accumuloSiteTag: "",
- hawqSiteTag: "",
- secondNameNodeHost: "",
- initializeTasks: function () {
- this._super();
- var numSpliced = 0;
- // find hostname where second namenode will be installed
- this.set('secondNameNodeHost', this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').findProperty('isInstalled', false).hostName);
- if (!App.Service.find().someProperty('serviceName', 'PXF') || this.isPxfComponentInstalled()) {
- this.get('tasks').splice(this.get('tasks').findProperty('command', 'installPXF').get('id'), 1);
- numSpliced = 1;
- }
- if (!App.Service.find().someProperty('serviceName', 'HBASE')) {
- this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHBase').get('id') - numSpliced, 1);
- numSpliced++;
- }
- if (!App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
- this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureAccumulo').get('id') - numSpliced, 1);
- numSpliced++ ;
- }
- if (!App.Service.find().someProperty('serviceName', 'HAWQ')) {
- this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHawq').get('id') - numSpliced, 1);
- }
- },
- startSecondNameNode: function () {
- var hostName = this.get('secondNameNodeHost');
- this.updateComponent('NAMENODE', hostName, "HDFS", "Start");
- },
- installZKFC: function () {
- var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
- this.createComponent('ZKFC', hostName, "HDFS");
- },
- startZKFC: function () {
- var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
- this.updateComponent('ZKFC', hostName, "HDFS", "Start");
- },
- isPxfComponentInstalled: function () {
- var pxfComponent = this.getSlaveComponentHosts().findProperty('componentName', 'PXF');
- if (pxfComponent !== undefined) {
- var host;
- // check if PXF is already installed on the host assigned for additional NameNode
- for (var i = 0; i < pxfComponent.hosts.length; i++) {
- host = pxfComponent.hosts[i];
- if (host.hostName === this.get('secondNameNodeHost'))
- return true;
- }
- }
- return false;
- },
- installPXF: function () {
- this.createComponent('PXF', this.get('secondNameNodeHost'), "PXF");
- },
- reconfigureHBase: function () {
- var data = this.get('content.serviceConfigProperties');
- var configData = this.reconfigureSites(['hbase-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
- App.ajax.send({
- name: 'common.service.configurations',
- sender: this,
- data: {
- desired_config: configData
- },
- success: 'saveConfigTag',
- error: 'onTaskError'
- });
- },
- reconfigureAccumulo: function () {
- var data = this.get('content.serviceConfigProperties');
- var configData = this.reconfigureSites(['accumulo-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
- App.ajax.send({
- name: 'common.service.configurations',
- sender: this,
- data: {
- desired_config: configData
- },
- success: 'saveConfigTag',
- error: 'onTaskError'
- });
- },
- reconfigureHawq: function () {
- var data = this.get('content.serviceConfigProperties');
- var reconfigureFiles = ['hawq-site', 'hdfs-client'];
- reconfigureFiles.forEach(function (fileName) {
- var configData = this.reconfigureSites([fileName], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('NAMENODE')));
- App.ajax.send({
- name: 'common.service.configurations',
- sender: this,
- data: {
- desired_config: configData
- },
- success: 'saveConfigTag',
- error: 'onTaskError'
- });
- }, this);
- },
- saveConfigTag: function () {
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('content.cluster.name'),
- clusterState: 'HIGH_AVAILABILITY_DEPLOY',
- wizardControllerName: this.get('content.controllerName'),
- localdb: App.db.data
- });
- this.onTaskCompleted();
- },
- startAllServices: function () {
- this.startServices(false);
- },
- deleteSNameNode: function () {
- var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
- App.ajax.send({
- name: 'common.delete.host_component',
- sender: this,
- data: {
- componentName: 'SECONDARY_NAMENODE',
- hostName: hostName
- },
- success: 'onTaskCompleted',
- error: 'onTaskError'
- });
- }
- });
|