Search in sources :

Example 1 with ServerInstance

use of com.linkedin.pinot.server.starter.ServerInstance in project pinot by linkedin.

the class ResourceTestHelper method setup.

/**
   * Sets up Pinot server instance, index directory for creation of segments, creates a default segment
   * and starts pinot admin api service
   * This should be called only once in the  @BeforeClass method of a unit test.
   * Caller must ensure teardown() is called when the test completes (in @AfterClass)
   */
public void setup() throws Exception {
    INDEX_DIR = Files.createTempDirectory(TableSizeResourceTest.class.getName() + "_segmentDir").toFile();
    File confFile = new File(TestUtils.getFileFromResourceUrl(InstanceServerStarter.class.getClassLoader().getResource("conf/pinot.properties")));
    config = new PropertiesConfiguration();
    config.setDelimiterParsingDisabled(false);
    config.load(confFile);
    serverConf = new ServerConf(config);
    LOGGER.info("Trying to create a new ServerInstance!");
    serverInstance = new ServerInstance();
    LOGGER.info("Trying to initial ServerInstance!");
    serverInstance.init(serverConf, new MetricsRegistry());
    LOGGER.info("Trying to start ServerInstance!");
    serverInstance.start();
    apiApplication = new AdminApiApplication(serverInstance);
    apiApplication.start(Integer.parseInt(CommonConstants.Server.DEFAULT_ADMIN_API_PORT));
    client = ClientBuilder.newClient();
    target = client.target(apiApplication.getBaseUri().toString());
    setupSegment();
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerConf(com.linkedin.pinot.server.conf.ServerConf) InstanceServerStarter(com.linkedin.pinot.server.integration.InstanceServerStarter) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) AdminApiApplication(com.linkedin.pinot.server.starter.helix.AdminApiApplication)

Example 2 with ServerInstance

use of com.linkedin.pinot.server.starter.ServerInstance in project pinot by linkedin.

the class FileBasedServerBrokerStarters method startAll.

public void startAll() throws Exception {
    final PropertiesConfiguration broker = brokerProperties();
    final PropertiesConfiguration server = serverProperties();
    log(broker, "broker");
    log(server, "server");
    System.out.println("************************ 1");
    serverInstance = new ServerInstance();
    System.out.println("************************ 2");
    serverInstance.init(new ServerConf(server), new MetricsRegistry());
    System.out.println("************************ 3");
    bld = new BrokerServerBuilder(broker, null, null, null);
    System.out.println("************************ 4");
    bld.buildNetwork();
    System.out.println("************************ 5");
    bld.buildHTTP();
    System.out.println("************************ 6");
    startServer();
    startBroker();
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerConf(com.linkedin.pinot.server.conf.ServerConf) BrokerServerBuilder(com.linkedin.pinot.broker.broker.BrokerServerBuilder) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 3 with ServerInstance

use of com.linkedin.pinot.server.starter.ServerInstance in project pinot by linkedin.

the class HelixServerStarter method startServerInstance.

private void startServerInstance(Configuration moreConfigurations) throws Exception {
    Utils.logVersions();
    _serverConf = getInstanceServerConfig(moreConfigurations);
    setupHelixSystemProperties(moreConfigurations);
    if (_serverInstance == null) {
        _serverInstance = new ServerInstance();
        _serverInstance.init(_serverConf, new MetricsRegistry());
        _serverInstance.start();
        LOGGER.info("Started server instance");
    }
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance)

Example 4 with ServerInstance

use of com.linkedin.pinot.server.starter.ServerInstance in project pinot by linkedin.

the class HelixStarterTest method testSingleHelixServerStartAndTakingSegment.

@Test
public void testSingleHelixServerStartAndTakingSegment() throws Exception {
    Configuration pinotHelixProperties = new PropertiesConfiguration();
    pinotHelixProperties.addProperty("pinot.server.instance.id", "localhost:0000");
    ServerConf serverConf = DefaultHelixStarterServerConfig.getDefaultHelixServerConfig(pinotHelixProperties);
    ServerInstance serverInstance = new ServerInstance();
    serverInstance.init(serverConf, new MetricsRegistry());
    serverInstance.start();
    File segmentDir0 = new File(INDEX_DIR, "segment0");
    setupSegment(segmentDir0, "testTable0");
    File[] segment0Files = segmentDir0.listFiles();
    Assert.assertNotNull(segment0Files);
    File segmentDir1 = new File(INDEX_DIR, "segment1");
    setupSegment(segmentDir1, "testTable1");
    File[] segment1Files = segmentDir1.listFiles();
    Assert.assertNotNull(segment1Files);
    File segmentDir2 = new File(INDEX_DIR, "segment2");
    setupSegment(segmentDir2, "testTable2");
    File[] segment2Files = segmentDir2.listFiles();
    Assert.assertNotNull(segment2Files);
    DataManager instanceDataManager = serverInstance.getInstanceDataManager();
    instanceDataManager.addSegment(columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment0Files[0].getAbsolutePath()), null, null);
    instanceDataManager.addSegment(columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment1Files[0].getAbsolutePath()), null, null);
    instanceDataManager.addSegment(columnarSegmentMetadataLoader.loadIndexSegmentMetadataFromDir(segment2Files[0].getAbsolutePath()), null, null);
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerConf(com.linkedin.pinot.server.conf.ServerConf) Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) DataManager(com.linkedin.pinot.common.data.DataManager) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) Test(org.testng.annotations.Test)

Example 5 with ServerInstance

use of com.linkedin.pinot.server.starter.ServerInstance in project pinot by linkedin.

the class IntegrationTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    //Process Command Line to get config and port
    FileUtils.deleteDirectory(new File("/tmp/pinot/test1"));
    setupSegmentList();
    File confFile = new File(TestUtils.getFileFromResourceUrl(InstanceServerStarter.class.getClassLoader().getResource("conf/" + PINOT_PROPERTIES)));
    // build _serverConf
    PropertiesConfiguration serverConf = new PropertiesConfiguration();
    serverConf.setDelimiterParsingDisabled(false);
    serverConf.load(confFile);
    _serverConf = new ServerConf(serverConf);
    LOGGER.info("Trying to create a new ServerInstance!");
    _serverInstance = new ServerInstance();
    LOGGER.info("Trying to initial ServerInstance!");
    _serverInstance.init(_serverConf, new MetricsRegistry());
    LOGGER.info("Trying to start ServerInstance!");
    _serverInstance.start();
    _queryExecutor = _serverInstance.getQueryExecutor();
    FileBasedInstanceDataManager instanceDataManager = (FileBasedInstanceDataManager) _serverInstance.getInstanceDataManager();
    for (int i = 0; i < 2; ++i) {
        instanceDataManager.getTableDataManager("testTable");
        instanceDataManager.getTableDataManager("testTable").addSegment(_indexSegmentList.get(i));
    }
}
Also used : MetricsRegistry(com.yammer.metrics.core.MetricsRegistry) ServerConf(com.linkedin.pinot.server.conf.ServerConf) FileBasedInstanceDataManager(com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager) ServerInstance(com.linkedin.pinot.server.starter.ServerInstance) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

ServerInstance (com.linkedin.pinot.server.starter.ServerInstance)5 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)5 ServerConf (com.linkedin.pinot.server.conf.ServerConf)4 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)4 File (java.io.File)3 BrokerServerBuilder (com.linkedin.pinot.broker.broker.BrokerServerBuilder)1 DataManager (com.linkedin.pinot.common.data.DataManager)1 FileBasedInstanceDataManager (com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager)1 InstanceServerStarter (com.linkedin.pinot.server.integration.InstanceServerStarter)1 AdminApiApplication (com.linkedin.pinot.server.starter.helix.AdminApiApplication)1 Configuration (org.apache.commons.configuration.Configuration)1 BeforeTest (org.testng.annotations.BeforeTest)1 Test (org.testng.annotations.Test)1