Search in sources :

Example 1 with HelixBrokerStarter

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);
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) HelixBrokerStarter(com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 2 with HelixBrokerStarter

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);
    }
}
Also used : ZkClient(org.I0Itec.zkclient.ZkClient) ExternalView(org.apache.helix.model.ExternalView) PinotHelixResourceManager(com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager) Configuration(org.apache.commons.configuration.Configuration) JSONObject(org.json.JSONObject) HelixBrokerStarter(com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter) AbstractTableConfig(com.linkedin.pinot.common.config.AbstractTableConfig) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with HelixBrokerStarter

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;
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) HelixBrokerStarter(com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Aggregations

HelixBrokerStarter (com.linkedin.pinot.broker.broker.helix.HelixBrokerStarter)3 Configuration (org.apache.commons.configuration.Configuration)3 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)2 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)1 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)1 ZkClient (org.I0Itec.zkclient.ZkClient)1 ExternalView (org.apache.helix.model.ExternalView)1 JSONObject (org.json.JSONObject)1 BeforeTest (org.testng.annotations.BeforeTest)1