mirror of https://github.com/apache/druid.git
make switching between scaling strategies config based
This commit is contained in:
parent
4d6cfdc774
commit
f39af83be4
|
@ -83,4 +83,8 @@ public abstract class IndexerCoordinatorConfig
|
|||
@Config("druid.merger.rowFlushBoundary")
|
||||
@Default("500000")
|
||||
public abstract long getRowFlushBoundary();
|
||||
|
||||
@Config("druid.indexer.strategy")
|
||||
@Default("noop")
|
||||
public abstract String getStrategyImpl();
|
||||
}
|
||||
|
|
|
@ -468,17 +468,27 @@ public class IndexerCoordinatorNode
|
|||
.build()
|
||||
);
|
||||
|
||||
ScalingStrategy strategy = new EC2AutoScalingStrategy(
|
||||
new AmazonEC2Client(
|
||||
new BasicAWSCredentials(
|
||||
props.getProperty("com.metamx.aws.accessKey"),
|
||||
props.getProperty("com.metamx.aws.secretKey")
|
||||
)
|
||||
),
|
||||
configFactory.build(EC2AutoScalingStrategyConfig.class)
|
||||
);
|
||||
// TODO: use real strategy before actual deployment
|
||||
strategy = new NoopScalingStrategy();
|
||||
ScalingStrategy strategy;
|
||||
if (config.getStrategyImpl().equalsIgnoreCase("ec2")) {
|
||||
strategy = new EC2AutoScalingStrategy(
|
||||
new AmazonEC2Client(
|
||||
new BasicAWSCredentials(
|
||||
props.getProperty("com.metamx.aws.accessKey"),
|
||||
props.getProperty("com.metamx.aws.secretKey")
|
||||
)
|
||||
),
|
||||
configFactory.build(EC2AutoScalingStrategyConfig.class)
|
||||
);
|
||||
} else if (config.getStorageImpl().equalsIgnoreCase("noop")) {
|
||||
strategy = new NoopScalingStrategy();
|
||||
} else {
|
||||
throw new IllegalStateException(
|
||||
String.format(
|
||||
"Invalid strategy implementation: %s",
|
||||
config.getStrategyImpl()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return new RemoteTaskRunner(
|
||||
jsonMapper,
|
||||
|
|
Loading…
Reference in New Issue