in ambari-web/app/controllers/wizard/step8_controller.js [1132:1268]
createAllHostComponents: function () {
var masterHosts = this.get('content.masterComponentHosts');
var slaveHosts = this.get('content.slaveComponentHosts');
var clients = this.get('content.clients');
// note: masterHosts has 'component' vs slaveHosts has 'componentName'
var masterComponents = masterHosts.mapProperty('component').uniq();
masterComponents.forEach(function (component) {
var hostNames = masterHosts.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
this.registerHostsToComponent(hostNames, component);
}, this);
slaveHosts.forEach(function (_slave) {
if (_slave.componentName !== 'CLIENT') {
var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
this.registerHostsToComponent(hostNames, _slave.componentName);
} else {
clients.forEach(function (_client) {
var hostNames = _slave.hosts.mapProperty('hostName');
switch (_client.component_name) {
case 'HDFS_CLIENT':
// install HDFS_CLIENT on HBASE_MASTER, HBASE_REGIONSERVER, WEBHCAT_SERVER, HISTORYSERVER and OOZIE_SERVER hosts
masterHosts.filterProperty('component', 'HBASE_MASTER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'HBASE_REGIONSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'HISTORYSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'MAPREDUCE_CLIENT':
// install MAPREDUCE_CLIENT on HIVE_SERVER, OOZIE_SERVER, NAGIOS_SERVER, and WEBHCAT_SERVER hosts
masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'OOZIE_CLIENT':
// install OOZIE_CLIENT on NAGIOS_SERVER host
masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'ZOOKEEPER_CLIENT':
// install ZOOKEEPER_CLIENT on WEBHCAT_SERVER host
masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'HIVE_CLIENT':
//install HIVE client on NAGIOS_SERVER host
masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'HCAT':
// install HCAT (client) on NAGIOS_SERVER host
masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
case 'YARN_CLIENT':
// install YARN_CLIENT on NAGIOS_SERVER,HIVE_SERVER,OOZIE_SERVER,WEBHCAT_SERVER host
masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
hostNames.pushObject(_masterHost.hostName);
}, this);
break;
}
hostNames = hostNames.uniq();
if (_client.isInstalled) {
//check whether clients are already installed on selected master hosts!!!
var installedHosts = _slave.hosts.filterProperty('isInstalled', true).mapProperty('hostName');
installedHosts.forEach(function (host) {
if (hostNames.contains(host)) {
hostNames.splice(hostNames.indexOf(host), 1);
}
}, this);
}
this.registerHostsToComponent(hostNames, _client.component_name);
}, this);
}
}, this);
// add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
var gangliaService = this.get('content.services').filterProperty('isSelected', true).findProperty('serviceName', 'GANGLIA');
if (gangliaService) {
var hosts = this.getRegisteredHosts();
if (gangliaService.get('isInstalled')) {
hosts = hosts.filterProperty('isInstalled', false);
}
if (hosts.length) {
this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
}
}
// add MySQL Server if Hive is selected
var hiveService = this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).findProperty('serviceName', 'HIVE');
if (hiveService) {
var hiveDb = this.get('content.serviceConfigProperties').findProperty('name', 'hive_database');
if(hiveDb.value == "New MySQL Database") {
this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'MYSQL_SERVER');
}
}
},