use of com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException in project cloudbreak by hortonworks.
the class WaitClusterManagerHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<WaitForClusterManagerRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.waitForClusterManager(stackId);
response = new WaitForClusterManagerSuccess(stackId);
} catch (RuntimeException | ClusterClientInitException | CloudbreakException e) {
LOGGER.error("WaitClusterManagerHandler step failed with the following message: {}", e.getMessage());
response = new WaitForClusterManagerFailed(stackId, e);
}
return response;
}
use of com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException in project cloudbreak by hortonworks.
the class ClusterManagerUpscaleService method upscaleClusterManager.
public void upscaleClusterManager(Long stackId, Map<String, Integer> hostGroupWithAdjustment, boolean primaryGatewayChanged, boolean repair) throws ClusterClientInitException {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
// we need to fetch the cluster with the details, to avoid the unnecessary DB querying later
Long clusterId = stack.getCluster().getId();
Cluster cluster = clusterService.findOneWithLists(clusterId).orElseThrow(NotFoundException.notFound("Cluster", clusterId));
LOGGER.debug("Adding new nodes for host group {}", hostGroupWithAdjustment);
NodeReachabilityResult nodeReachabilityResult = hostRunner.addClusterServices(stack, cluster, hostGroupWithAdjustment, repair);
if (primaryGatewayChanged) {
clusterServiceRunner.updateAmbariClientConfig(stack, cluster);
}
clusterService.updateInstancesToRunning(clusterId, nodeReachabilityResult.getReachableNodes());
clusterService.updateInstancesToZombie(stackId, nodeReachabilityResult.getUnreachableNodes());
ClusterApi connector = clusterApiConnectors.getConnector(stack);
ExtendedPollingResult result;
if (!repair && !primaryGatewayChanged && targetedUpscaleSupportService.targetedUpscaleOperationSupported(stack)) {
Set<String> reachableHosts = nodeReachabilityResult.getReachableHosts();
Set<InstanceMetaData> reachableInstances = stack.getNotDeletedAndNotZombieInstanceMetaDataSet().stream().filter(md -> reachableHosts.contains(md.getDiscoveryFQDN())).collect(Collectors.toSet());
result = connector.waitForHosts(reachableInstances);
} else {
result = connector.waitForHosts(stackService.getByIdWithListsInTransaction(stackId).getRunningInstanceMetaDataSet());
}
if (result != null && result.isTimeout()) {
LOGGER.info("Upscaling cluster manager were not successful for nodes: {}", result.getFailedInstanceIds());
instanceMetaDataService.updateInstanceStatus(result.getFailedInstanceIds(), InstanceStatus.ZOMBIE, "Upscaling cluster manager were not successful.");
}
}
use of com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException in project cloudbreak by hortonworks.
the class AutoConfigureClusterManagerHandler method accept.
@Override
public void accept(Event<AutoConfigureClusterManagerRequest> event) {
Long stackId = event.getData().getResourceId();
Selectable response;
try {
clusterBuilderService.autoConfigureCluster(stackId);
response = new AutoConfigureClusterManagerSuccess(stackId);
} catch (RuntimeException | ClusterClientInitException | CloudbreakException e) {
LOGGER.error("Failed to autoconfigure Cloudera Manager cluster: {}", e.getMessage());
response = new AutoConfigureClusterManagerFailed(stackId, e);
}
eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method initApiClient.
@PostConstruct
public void initApiClient() throws ClusterClientInitException {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
try {
apiClient = clouderaManagerApiClientProvider.getV31Client(stack.getGatewayPort(), user, password, clientConfig);
} catch (ClouderaManagerClientInitException e) {
throw new ClusterClientInitException(e);
}
}
use of com.sequenceiq.cloudbreak.cluster.service.ClusterClientInitException in project cloudbreak by hortonworks.
the class ClouderaManagerSetupService method waitForHostsHealthy.
@Override
public void waitForHostsHealthy(Set<InstanceMetaData> hostsInCluster) throws ClusterClientInitException {
Cluster cluster = stack.getCluster();
String user = cluster.getCloudbreakAmbariUser();
String password = cluster.getCloudbreakAmbariPassword();
ApiClient client;
try {
client = clouderaManagerApiClientProvider.getV31Client(stack.getGatewayPort(), user, password, clientConfig);
} catch (ClouderaManagerClientInitException e) {
throw new ClusterClientInitException(e);
}
clouderaManagerPollingServiceProvider.startPollingCmHostStatusHealthy(stack, client, hostsInCluster.stream().map(x -> x.getDiscoveryFQDN()).collect(Collectors.toUnmodifiableSet()));
}
Aggregations