private ConfigureHealthCheckRequest buildHealthCheckRequest(AWSLoadBalancerContext context) { HealthCheckConfiguration healthCheckConfiguration = context.loadBalancerStateExpanded.routes .stream() .filter(config -> config != null && config.healthCheckConfiguration != null) .map(config -> config.healthCheckConfiguration).findFirst().orElse(null); if (healthCheckConfiguration == null) { return null; } // Construct the target HTTP:80/index.html String target = healthCheckConfiguration.protocol + ":" + healthCheckConfiguration.port + healthCheckConfiguration.urlPath; HealthCheck healthCheck = new HealthCheck() .withHealthyThreshold(healthCheckConfiguration.healthyThreshold) .withInterval(healthCheckConfiguration.intervalSeconds).withTarget(target) .withTimeout(healthCheckConfiguration.timeoutSeconds) .withUnhealthyThreshold(healthCheckConfiguration.unhealthyThreshold); return new ConfigureHealthCheckRequest() .withLoadBalancerName(context.loadBalancerStateExpanded.name) .withHealthCheck(healthCheck); }
private void verifyHealthCheckConfiguration(RouteConfiguration routeConfiguration, HealthCheck healthCheck) { HealthCheckConfiguration healthCheckConfiguration = routeConfiguration.healthCheckConfiguration; assertEquals(healthCheckConfiguration.timeoutSeconds, healthCheck.getTimeout()); assertEquals(healthCheckConfiguration.healthyThreshold, healthCheck.getHealthyThreshold()); assertEquals(healthCheckConfiguration.intervalSeconds, healthCheck.getInterval()); assertEquals(healthCheckConfiguration.unhealthyThreshold, healthCheck.getUnhealthyThreshold()); String target = healthCheckConfiguration.protocol + ":" + healthCheckConfiguration.port + healthCheckConfiguration.urlPath; assertEquals(target, healthCheck.getTarget()); }
private void configureHealthCheck() { // optimize for high load the instances take longer to response, especially in Multi-AZ, // there are multiple ELB instances send health check requests same time HealthCheck healthCheck = new HealthCheck() .withHealthyThreshold(2) .withUnhealthyThreshold(5) .withInterval(20) .withTimeout(15) .withTarget("HTTP:80" + resource.healthCheckURL); AWS.elb.elb.configureHealthCheck(new ConfigureHealthCheckRequest(resource.name, healthCheck)); }
public void configureHealthCheck(AwsProcessClient awsProcessClient, Long loadBalancerNo) { LoadBalancerHealthCheck healthCheck = loadBalancerHealthCheckDao.read(loadBalancerNo); // ヘルスチェック情報がない場合はスキップ if (healthCheck == null) { return; } AwsLoadBalancer awsLoadBalancer = awsLoadBalancerDao.read(loadBalancerNo); // ヘルスチェック設定を作成 HealthCheck healthCheck2 = new HealthCheck(); String target = healthCheck.getCheckProtocol() + ":" + healthCheck.getCheckPort(); if (StringUtils.isNotEmpty(healthCheck.getCheckPath())) { if (healthCheck.getCheckPath().charAt(0) != '/') { target = target + "/"; } target = target + healthCheck.getCheckPath(); } healthCheck2.withTarget(target); healthCheck2.withTimeout(healthCheck.getCheckTimeout()); healthCheck2.withInterval(healthCheck.getCheckInterval()); healthCheck2.withHealthyThreshold(healthCheck.getHealthyThreshold()); healthCheck2.withUnhealthyThreshold(healthCheck.getUnhealthyThreshold()); // ヘルスチェック設定に変更がない場合はスキップ LoadBalancerDescription description = awsCommonProcess.describeLoadBalancer(awsProcessClient, awsLoadBalancer.getName()); HealthCheck healthCheck3 = description.getHealthCheck(); if (StringUtils.equals(healthCheck2.getTarget(), healthCheck3.getTarget()) && ObjectUtils.equals(healthCheck2.getTimeout(), healthCheck3.getTimeout()) && ObjectUtils.equals(healthCheck2.getInterval(), healthCheck3.getInterval()) && ObjectUtils.equals(healthCheck2.getHealthyThreshold(), healthCheck3.getHealthyThreshold()) && ObjectUtils.equals(healthCheck2.getUnhealthyThreshold(), healthCheck3.getUnhealthyThreshold())) { return; } // ヘルスチェック設定を変更 ConfigureHealthCheckRequest request = new ConfigureHealthCheckRequest(); request.withLoadBalancerName(awsLoadBalancer.getName()); request.withHealthCheck(healthCheck2); awsProcessClient.getElbClient().configureHealthCheck(request); if (log.isInfoEnabled()) { log.info(MessageUtils.getMessage("IPROCESS-200131", awsLoadBalancer.getName())); } // イベントログ出力 processLogger.debug(null, null, "AwsElbHealthCheckConfig", new Object[] { awsProcessClient.getPlatform().getPlatformName(), awsLoadBalancer.getName() }); }