use of org.apache.hyracks.control.common.controllers.CCConfig 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.CCConfig in project asterixdb by apache.
the class AsterixHyracksIntegrationUtil method createCCConfig.
protected CCConfig createCCConfig(ConfigManager configManager) throws IOException {
CCConfig ccConfig = new CCConfig(configManager);
ccConfig.setClusterListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
ccConfig.setClientListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
ccConfig.setClientListenPort(DEFAULT_HYRACKS_CC_CLIENT_PORT);
ccConfig.setClusterListenPort(DEFAULT_HYRACKS_CC_CLUSTER_PORT);
ccConfig.setResultTTL(120000L);
ccConfig.setResultSweepThreshold(1000L);
configManager.set(ControllerConfig.Option.DEFAULT_DIR, joinPath(getDefaultStoragePath(), "asterixdb"));
return ccConfig;
}
use of org.apache.hyracks.control.common.controllers.CCConfig in project asterixdb by apache.
the class AsterixHyracksIntegrationUtil method init.
public void init(boolean deleteOldInstanceData) throws Exception {
final ICCApplication ccApplication = createCCApplication();
configManager = new ConfigManager();
ccApplication.registerConfig(configManager);
final CCConfig ccConfig = createCCConfig(configManager);
cc = new ClusterControllerService(ccConfig, ccApplication);
nodeNames = ccConfig.getConfigManager().getNodeNames();
if (deleteOldInstanceData) {
deleteTransactionLogs();
removeTestStorageFiles();
}
final List<NodeControllerService> nodeControllers = new ArrayList<>();
for (String nodeId : nodeNames) {
// mark this NC as virtual in the CC's config manager, so he doesn't try to contact NCService...
configManager.set(nodeId, NCConfig.Option.VIRTUAL_NC, true);
final INCApplication ncApplication = createNCApplication();
ConfigManager ncConfigManager = new ConfigManager();
ncApplication.registerConfig(ncConfigManager);
nodeControllers.add(new NodeControllerService(fixupIODevices(createNCConfig(nodeId, ncConfigManager)), ncApplication));
}
;
cc.start();
// Starts ncs.
nodeNames = ccConfig.getConfigManager().getNodeNames();
List<Thread> startupThreads = new ArrayList<>();
for (NodeControllerService nc : nodeControllers) {
Thread ncStartThread = new Thread("IntegrationUtil-" + nc.getId()) {
@Override
public void run() {
try {
nc.start();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
};
ncStartThread.start();
startupThreads.add(ncStartThread);
}
//wait until all NCs complete their startup
for (Thread thread : startupThreads) {
thread.join();
}
// Wait until cluster becomes active
ClusterStateManager.INSTANCE.waitForState(ClusterState.ACTIVE);
hcc = new HyracksConnection(cc.getConfig().getClientListenAddress(), cc.getConfig().getClientListenPort());
this.ncs = nodeControllers.toArray(new NodeControllerService[nodeControllers.size()]);
}
use of org.apache.hyracks.control.common.controllers.CCConfig in project asterixdb by apache.
the class HyracksUtils method init.
public static void init() throws Exception {
CCConfig ccConfig = new CCConfig();
ccConfig.setClientListenAddress(CC_HOST);
ccConfig.setClusterListenAddress(CC_HOST);
ccConfig.setClusterListenPort(TEST_HYRACKS_CC_PORT);
ccConfig.setClientListenPort(TEST_HYRACKS_CC_CLIENT_PORT);
ccConfig.setJobHistorySize(0);
ccConfig.setProfileDumpPeriod(-1);
// cluster controller
cc = new ClusterControllerService(ccConfig);
cc.start();
// two node controllers
NCConfig ncConfig1 = new NCConfig(NC1_ID);
ncConfig1.setClusterAddress("localhost");
ncConfig1.setClusterListenAddress("localhost");
ncConfig1.setClusterPort(TEST_HYRACKS_CC_PORT);
ncConfig1.setDataListenAddress("127.0.0.1");
ncConfig1.setResultListenAddress("127.0.0.1");
nc1 = new NodeControllerService(ncConfig1);
nc1.start();
NCConfig ncConfig2 = new NCConfig(NC2_ID);
ncConfig2.setClusterAddress("localhost");
ncConfig2.setClusterListenAddress("localhost");
ncConfig2.setClusterPort(TEST_HYRACKS_CC_PORT);
ncConfig2.setDataListenAddress("127.0.0.1");
ncConfig2.setResultListenAddress("127.0.0.1");
nc2 = new NodeControllerService(ncConfig2);
nc2.start();
// hyracks connection
hcc = new HyracksConnection(CC_HOST, TEST_HYRACKS_CC_CLIENT_PORT);
}
use of org.apache.hyracks.control.common.controllers.CCConfig in project asterixdb by apache.
the class AlgebricksHyracksIntegrationUtil method init.
public static void init() throws Exception {
FileUtils.deleteQuietly(new File(joinPath("target", "data")));
FileUtils.copyDirectory(new File("data"), new File(joinPath("target", "data")));
CCConfig ccConfig = new CCConfig();
ccConfig.setClientListenAddress("127.0.0.1");
ccConfig.setClientListenPort(TEST_HYRACKS_CC_CLIENT_NET_PORT);
ccConfig.setClusterListenAddress("127.0.0.1");
ccConfig.setClusterListenPort(TEST_HYRACKS_CC_CLUSTER_NET_PORT);
cc = new ClusterControllerService(ccConfig);
cc.start();
NCConfig ncConfig1 = new NCConfig(NC1_ID);
ncConfig1.setClusterAddress("localhost");
ncConfig1.setClusterPort(TEST_HYRACKS_CC_CLUSTER_NET_PORT);
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") });
FileUtils.forceMkdir(new File(ncConfig1.getIODevices()[0]));
nc1 = new NodeControllerService(ncConfig1);
nc1.start();
NCConfig ncConfig2 = new NCConfig(NC2_ID);
ncConfig2.setClusterAddress("localhost");
ncConfig2.setClusterPort(TEST_HYRACKS_CC_CLUSTER_NET_PORT);
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") });
FileUtils.forceMkdir(new File(ncConfig1.getIODevices()[0]));
nc2 = new NodeControllerService(ncConfig2);
nc2.start();
hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
}
Aggregations