use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.
the class AbstractIntegrationTest method init.
@BeforeClass
public static void init() throws Exception {
CCConfig ccConfig = new CCConfig();
ccConfig.setClientListenAddress("127.0.0.1");
ccConfig.setClientListenPort(39000);
ccConfig.setClusterListenAddress("127.0.0.1");
ccConfig.setClusterListenPort(39001);
ccConfig.setProfileDumpPeriod(10000);
FileUtils.deleteQuietly(new File("target" + File.separator + "data"));
FileUtils.copyDirectory(new File("data"), new File(joinPath("target", "data")));
File outDir = new File("target" + File.separator + "ClusterController");
outDir.mkdirs();
File ccRoot = File.createTempFile(AbstractIntegrationTest.class.getName(), ".data", outDir);
ccRoot.delete();
ccRoot.mkdir();
ccConfig.setRootDir(ccRoot.getAbsolutePath());
cc = new ClusterControllerService(ccConfig);
cc.start();
NCConfig ncConfig1 = new NCConfig(NC1_ID);
ncConfig1.setClusterAddress("localhost");
ncConfig1.setClusterPort(39001);
ncConfig1.setClusterListenAddress("127.0.0.1");
ncConfig1.setDataListenAddress("127.0.0.1");
ncConfig1.setResultListenAddress("127.0.0.1");
ncConfig1.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device0") });
nc1 = new NodeControllerService(ncConfig1);
nc1.start();
NCConfig ncConfig2 = new NCConfig(NC2_ID);
ncConfig2.setClusterAddress("localhost");
ncConfig2.setClusterPort(39001);
ncConfig2.setClusterListenAddress("127.0.0.1");
ncConfig2.setDataListenAddress("127.0.0.1");
ncConfig2.setResultListenAddress("127.0.0.1");
ncConfig2.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device1") });
nc2 = new NodeControllerService(ncConfig2);
nc2.start();
hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Starting CC in " + ccRoot.getAbsolutePath());
}
}
use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.
the class NCDriver method main.
public static void main(String[] args) {
try {
final String nodeId = ConfigUtils.getOptionValue(args, NCConfig.Option.NODE_ID);
final ConfigManager configManager = new ConfigManager(args);
INCApplication application = getApplication(args);
application.registerConfig(configManager);
NCConfig ncConfig = new NCConfig(nodeId, configManager);
final NodeControllerService ncService = new NodeControllerService(ncConfig, application);
ncService.start();
while (true) {
Thread.sleep(10000);
}
} catch (CmdLineException e) {
LOGGER.log(Level.FINE, "Exception parsing command line: " + Arrays.toString(args), e);
System.exit(2);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Exiting NCDriver due to exception", e);
System.exit(1);
}
}
use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.
the class PredistributedJobsTest method init.
@BeforeClass
public static void init() throws Exception {
CCConfig ccConfig = new CCConfig();
ccConfig.setClientListenAddress("127.0.0.1");
ccConfig.setClientListenPort(39000);
ccConfig.setClusterListenAddress("127.0.0.1");
ccConfig.setClusterListenPort(39001);
ccConfig.setProfileDumpPeriod(10000);
FileUtils.deleteQuietly(new File(joinPath("target", "data")));
FileUtils.copyDirectory(new File("data"), new File(joinPath("target", "data")));
File outDir = new File("target" + File.separator + "ClusterController");
outDir.mkdirs();
File ccRoot = File.createTempFile(AbstractIntegrationTest.class.getName(), ".data", outDir);
ccRoot.delete();
ccRoot.mkdir();
ccConfig.setRootDir(ccRoot.getAbsolutePath());
ClusterControllerService ccBase = new ClusterControllerService(ccConfig);
cc = Mockito.spy(ccBase);
cc.start();
NCConfig ncConfig1 = new NCConfig(NC1_ID);
ncConfig1.setClusterAddress("localhost");
ncConfig1.setClusterPort(39001);
ncConfig1.setClusterListenAddress("127.0.0.1");
ncConfig1.setDataListenAddress("127.0.0.1");
ncConfig1.setResultListenAddress("127.0.0.1");
ncConfig1.setResultSweepThreshold(5000);
ncConfig1.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device0") });
NodeControllerService nc1Base = new NodeControllerService(ncConfig1);
nc1 = Mockito.spy(nc1Base);
nc1.start();
NCConfig ncConfig2 = new NCConfig(NC2_ID);
ncConfig2.setClusterAddress("localhost");
ncConfig2.setClusterPort(39001);
ncConfig2.setClusterListenAddress("127.0.0.1");
ncConfig2.setDataListenAddress("127.0.0.1");
ncConfig2.setResultListenAddress("127.0.0.1");
ncConfig2.setResultSweepThreshold(5000);
ncConfig2.setIODevices(new String[] { joinPath(System.getProperty("user.dir"), "target", "data", "device1") });
NodeControllerService nc2Base = new NodeControllerService(ncConfig2);
nc2 = Mockito.spy(nc2Base);
nc2.start();
hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Starting CC in " + ccRoot.getAbsolutePath());
}
}
use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.
the class NodeManagerTest method mockNodeControllerState.
private NodeControllerState mockNodeControllerState(String nodeId, boolean invalidIpAddr) {
NodeControllerState ncState = mock(NodeControllerState.class);
String ipAddr = invalidIpAddr ? "255.255.255:255" : "127.0.0.2";
NetworkAddress dataAddr = new NetworkAddress(ipAddr, 1001);
NetworkAddress resultAddr = new NetworkAddress(ipAddr, 1002);
NetworkAddress msgAddr = new NetworkAddress(ipAddr, 1003);
when(ncState.getCapacity()).thenReturn(new NodeCapacity(NODE_MEMORY_SIZE, NODE_CORES));
when(ncState.getDataPort()).thenReturn(dataAddr);
when(ncState.getDatasetPort()).thenReturn(resultAddr);
when(ncState.getMessagingPort()).thenReturn(msgAddr);
NCConfig ncConfig = new NCConfig(nodeId);
ncConfig.setDataPublicAddress(ipAddr);
when(ncState.getNCConfig()).thenReturn(ncConfig);
return ncState;
}
use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.
the class GetNodeDetailsJSONWork method doRun.
@Override
protected void doRun() throws Exception {
if (nodeId == null) {
// null nodeId is a request for CC
detail = getCCDetails();
if (includeConfig) {
ConfigUtils.addConfigToJSON(detail, ccConfig.getAppConfig(), CC_SECTIONS);
detail.putPOJO("app.args", ccConfig.getAppArgs());
}
} else {
NodeControllerState ncs = nodeManager.getNodeControllerState(nodeId);
if (ncs != null) {
detail = ncs.toDetailedJSON(includeStats, includeConfig);
if (includeConfig) {
final NCConfig ncConfig = ncs.getNCConfig();
ConfigUtils.addConfigToJSON(detail, ncConfig.getConfigManager().getNodeEffectiveConfig(nodeId), NC_SECTIONS);
detail.putPOJO("app.args", ncConfig.getAppArgs());
}
}
}
if (callback != null) {
callback.setValue(detail == null ? null : om.writeValueAsString(detail));
}
}
Aggregations