use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class BrokerServerBuilder method buildHTTP.
public void buildHTTP() {
// build server which has servlet
Configuration c = _config.subset(CLIENT_CONFIG_PREFIX);
BrokerClientConf clientConfig = new BrokerClientConf(c);
_server = new Server(clientConfig.getQueryPort());
WebAppContext context = new WebAppContext();
context.addServlet(PinotClientRequestServlet.class, "/query");
context.addServlet(PinotBrokerHealthCheckServlet.class, "/health");
context.addServlet(PinotBrokerRoutingTableDebugServlet.class, "/debug/routingTable/*");
context.addServlet(PinotBrokerTimeBoundaryDebugServlet.class, "/debug/timeBoundary/*");
if (clientConfig.enableConsole()) {
context.setResourceBase(clientConfig.getConsoleWebappPath());
} else {
context.setResourceBase("");
}
context.addEventListener(new PinotBrokerServletContextChangeListener(_requestHandler, _brokerMetrics, _timeBoundaryService));
context.setAttribute(BrokerServerBuilder.class.toString(), this);
_server.setHandler(context);
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class DefaultHelixBrokerConfig method getDefaultBrokerConf.
public static Configuration getDefaultBrokerConf() {
Configuration brokerConf = new PropertiesConfiguration();
// config based routing
brokerConf.addProperty("pinot.broker.transport.routingMode", "HELIX");
brokerConf.addProperty("pinot.broker.routing.table.builder.default.offline.class", "balanced");
brokerConf.addProperty("pinot.broker.routing.table.builder.default.offline.numOfRoutingTables", "10");
brokerConf.addProperty("pinot.broker.routing.table.builder.default.realtime.class", "Kafkahighlevelconsumerbased");
brokerConf.addProperty("pinot.broker.routing.table.builder.tables", "");
//client properties
brokerConf.addProperty("pinot.broker.client.enableConsole", "true");
brokerConf.addProperty("pinot.broker.client.queryPort", "8099");
brokerConf.addProperty("pinot.broker.client.consolePath", "../webapp");
// [PINOT-2435] setting to 0 so it doesn't disconnect from zk
brokerConf.addProperty("pinot.broker.helix.flappingTimeWindowMs", "0");
return brokerConf;
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class DefaultHelixBrokerConfig method getDefaultBrokerConf.
public static Configuration getDefaultBrokerConf(Configuration externalConfigs) {
final Configuration defaultConfigs = getDefaultBrokerConf();
@SuppressWarnings("unchecked") Iterator<String> iterable = externalConfigs.getKeys();
while (iterable.hasNext()) {
String key = iterable.next();
defaultConfigs.setProperty(key, externalConfigs.getProperty(key));
}
return defaultConfigs;
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class HelixBrokerStarter method startDefault.
public static HelixBrokerStarter startDefault() throws Exception {
Configuration configuration = new PropertiesConfiguration();
int port = 5001;
configuration.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, port);
configuration.addProperty("pinot.broker.timeoutMs", 500 * 1000L);
final HelixBrokerStarter pinotHelixBrokerStarter = new HelixBrokerStarter("quickstart", "localhost:2122", configuration);
return pinotHelixBrokerStarter;
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class HelixBrokerStarterTest method setUp.
@BeforeTest
public void setUp() throws Exception {
_zookeeperInstance = ZkStarter.startLocalZkServer();
_zkClient = new ZkClient(ZkStarter.DEFAULT_ZK_STR);
final String instanceId = "localhost_helixController";
_pinotResourceManager = new PinotHelixResourceManager(ZkStarter.DEFAULT_ZK_STR, HELIX_CLUSTER_NAME, instanceId, null, 10000L, true, /*isUpdateStateModel=*/
false);
_pinotResourceManager.start();
final String helixZkURL = HelixConfig.getAbsoluteZkPathForHelix(ZkStarter.DEFAULT_ZK_STR);
_helixZkManager = HelixSetupUtils.setup(HELIX_CLUSTER_NAME, helixZkURL, instanceId, /*isUpdateStateModel=*/
false);
_helixAdmin = _helixZkManager.getClusterManagmentTool();
Thread.sleep(3000);
final Configuration pinotHelixBrokerProperties = DefaultHelixBrokerConfig.getDefaultBrokerConf();
pinotHelixBrokerProperties.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, 8943);
_helixBrokerStarter = new HelixBrokerStarter(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, pinotHelixBrokerProperties);
Thread.sleep(1000);
ControllerRequestBuilderUtil.addFakeBrokerInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 5, true);
ControllerRequestBuilderUtil.addFakeDataInstancesToAutoJoinHelixCluster(HELIX_CLUSTER_NAME, ZkStarter.DEFAULT_ZK_STR, 1, true);
final String tableName = "dining";
JSONObject buildCreateOfflineTableV2JSON = ControllerRequestBuilderUtil.buildCreateOfflineTableJSON(tableName, null, null, 1);
AbstractTableConfig config = AbstractTableConfig.init(buildCreateOfflineTableV2JSON.toString());
_pinotResourceManager.addTable(config);
for (int i = 1; i <= 5; i++) {
addOneSegment(tableName);
Thread.sleep(2000);
final ExternalView externalView = _helixAdmin.getResourceExternalView(HELIX_CLUSTER_NAME, TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(tableName));
Assert.assertEquals(externalView.getPartitionSet().size(), i);
}
}
Aggregations