use of com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter in project pinot by linkedin.
the class PerfBenchmarkDriver method startBroker.
private void startBroker() throws Exception {
if (!_conf.isStartBroker()) {
LOGGER.info("Skipping start broker step. Assumes broker is already started.");
return;
}
Configuration brokerConfiguration = new PropertiesConfiguration();
String brokerInstanceName = "Broker_localhost_" + CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT;
brokerConfiguration.setProperty("instanceId", brokerInstanceName);
LOGGER.info("Starting broker instance: {}", brokerInstanceName);
new HelixBrokerStarter(_clusterName, _zkAddress, brokerConfiguration);
}
use of com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter 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);
}
}
use of com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter in project pinot by linkedin.
the class StartBrokerCommand method execute.
@Override
public boolean execute() throws Exception {
if (_brokerHost == null) {
_brokerHost = NetUtil.getHostAddress();
}
Configuration configuration = readConfigFromFile(_configFileName);
if (configuration == null) {
if (_configFileName != null) {
LOGGER.error("Error: Unable to find file {}.", _configFileName);
return false;
}
configuration = new PropertiesConfiguration();
configuration.addProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, _brokerPort);
configuration.setProperty("pinot.broker.routing.table.builder.class", "random");
}
LOGGER.info("Executing command: " + toString());
final HelixBrokerStarter pinotHelixBrokerStarter = new HelixBrokerStarter(_clusterName, _zkAddress, configuration);
String pidFile = ".pinotAdminBroker-" + String.valueOf(System.currentTimeMillis()) + ".pid";
savePID(System.getProperty("java.io.tmpdir") + File.separator + pidFile);
return true;
}
Aggregations