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();
}
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();
}
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");
}
}
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);
}
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));
}
}
Aggregations