123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- /**
- * 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.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageController.extend({
- commands: ['stopAllServices', 'installNameNode', 'installJournalNodes', 'startJournalNodes', 'disableSNameNode', 'reconfigureHDFS'],
- stopAllServices: function () {
- App.ajax.send({
- name: 'admin.high_availability.stop_all_services',
- sender: this,
- success: 'startPolling',
- error: 'onTaskError'
- });
- },
- installNameNode: function () {
- var hostName = this.get('content.masterComponentHosts').findProperty('isAddNameNode').hostName;
- this.createComponent('NAMENODE', hostName);
- },
- installJournalNodes: function () {
- App.ajax.send({
- name: 'admin.high_availability.create_journalnode',
- sender: this,
- success: 'onJournalNodeCreate',
- error: 'onJournalNodeCreate'
- });
- },
- onJournalNodeCreate: function () {
- var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
- this.createComponent('JOURNALNODE', hostNames);
- },
- startJournalNodes: function () {
- var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
- this.startComponent('JOURNALNODE', hostNames);
- },
- disableSNameNode: function () {
- var hostName = this.get('content.masterComponentHosts').findProperty('component', 'SECONDARY_NAMENODE').hostName;
- App.ajax.send({
- name: 'admin.high_availability.maintenance_mode',
- sender: this,
- data: {
- hostName: hostName,
- componentName: 'SECONDARY_NAMENODE'
- },
- success: 'onTaskCompleted',
- error: 'onTaskError'
- });
- },
- reconfigureHDFS: function () {
- this.loadConfigsTags();
- },
- loadConfigsTags: function () {
- App.ajax.send({
- name: 'config.tags',
- sender: this,
- success: 'onLoadConfigsTags',
- error: 'onTaskError'
- });
- },
- onLoadConfigsTags: function (data) {
- var hdfsSiteTag = data.Clusters.desired_configs['hdfs-site'].tag;
- var coreSiteTag = data.Clusters.desired_configs['core-site'].tag;
- App.ajax.send({
- name: 'admin.high_availability.load_configs',
- sender: this,
- data: {
- hdfsSiteTag: hdfsSiteTag,
- coreSiteTag: coreSiteTag
- },
- success: 'onLoadConfigs',
- error: 'onTaskError'
- });
- },
- onLoadConfigs: function (data) {
- var hdfsSiteProperties = data.items.findProperty('type', 'hdfs-site').properties;
- var coreSiteProperties = data.items.findProperty('type', 'core-site').properties;
- var currentNameNodeHost = this.get('content.masterComponentHosts').findProperty('isCurNameNode').hostName;
- var newNameNodeHost = this.get('content.masterComponentHosts').findProperty('isAddNameNode').hostName;
- var journalNodeHosts = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
- var zooKeeperHosts = this.get('content.masterComponentHosts').filterProperty('component', 'ZOOKEEPER_SERVER').mapProperty('hostName');
- //hdfs-site configs changes
- hdfsSiteProperties['dfs.nameservices'] = 'mycluster';
- hdfsSiteProperties['dfs.ha.namenodes.mycluster'] = 'nn1,nn2';
- hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn1'] = currentNameNodeHost + ':8020';
- hdfsSiteProperties['dfs.namenode.rpc-address.mycluster.nn2'] = newNameNodeHost + ':8020';
- hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn1'] = currentNameNodeHost + ':50070';
- hdfsSiteProperties['dfs.namenode.http-address.mycluster.nn2'] = newNameNodeHost + ':50070';
- hdfsSiteProperties['dfs.namenode.shared.edits.dir'] = 'qjournal://' + journalNodeHosts[0] + ':8485:' + journalNodeHosts[1] + ':8485:' + journalNodeHosts[2] + ':8485:/mycluster';
- hdfsSiteProperties['dfs.client.failover.proxy.provider.mycluster'] = 'org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider';
- hdfsSiteProperties['dfs.ha.fencing.methods'] = 'shell(/bin/true)';
- hdfsSiteProperties['dfs.journalnode.edits.dir'] = '/grid/0/hdfs/journal';
- hdfsSiteProperties['dfs.ha.automatic-failover.enabled'] = 'true';
- //core-site configs changes
- coreSiteProperties['ha.zookeeper.quorum'] = zooKeeperHosts[0] + ':2181,' + zooKeeperHosts[1] + ':2181,' + zooKeeperHosts[2] + ':2181';
- coreSiteProperties['fs.defaultFS'] = 'hdfs://mycluster';
- this.set('configsSaved', false);
- App.ajax.send({
- name: 'admin.high_availability.save_configs',
- sender: this,
- data: {
- siteName: 'hdfs-site',
- properties: hdfsSiteProperties
- },
- success: 'installHDFSClients',
- error: 'onTaskError'
- });
- App.ajax.send({
- name: 'admin.high_availability.save_configs',
- sender: this,
- data: {
- siteName: 'core-site',
- properties: coreSiteProperties
- },
- success: 'installHDFSClients',
- error: 'onTaskError'
- });
- },
- configsSaved: false,
- installHDFSClients: function () {
- if (!this.get('configsSaved')) {
- this.set('configsSaved', true);
- return;
- }
- var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
- this.createComponent('HDFS_CLIENT', hostNames);
- }
- });
|