Search in sources :

Example 11 with NodeControllerService

use of org.apache.hyracks.control.nc.NodeControllerService 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());
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) File(java.io.File) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService)

Example 12 with NodeControllerService

use of org.apache.hyracks.control.nc.NodeControllerService 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);
    ccConfig.setHeartbeatPeriod(50);
    // 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);
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService)

Example 13 with NodeControllerService

use of org.apache.hyracks.control.nc.NodeControllerService in project asterixdb by apache.

the class AbstractMultiNCIntegrationTest 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);
    File outDir = new File("target" + File.separator + "ClusterController");
    outDir.mkdirs();
    File ccRoot = File.createTempFile(AbstractMultiNCIntegrationTest.class.getName(), ".data", outDir);
    ccRoot.delete();
    ccRoot.mkdir();
    ccConfig.setRootDir(ccRoot.getAbsolutePath());
    ccConfig.setAppClass(DummyApplication.class.getName());
    cc = new ClusterControllerService(ccConfig);
    cc.start();
    asterixNCs = new NodeControllerService[ASTERIX_IDS.length];
    for (int i = 0; i < ASTERIX_IDS.length; i++) {
        File ioDev = new File("target" + File.separator + ASTERIX_IDS[i] + File.separator + "ioDevice");
        FileUtils.forceMkdir(ioDev);
        FileUtils.copyDirectory(new File("data" + File.separator + "device0"), ioDev);
        NCConfig ncConfig = new NCConfig(ASTERIX_IDS[i]);
        ncConfig.setClusterAddress("localhost");
        ncConfig.setClusterPort(39001);
        ncConfig.setClusterListenAddress("127.0.0.1");
        ncConfig.setDataListenAddress("127.0.0.1");
        ncConfig.setResultListenAddress("127.0.0.1");
        ncConfig.setIODevices(new String[] { ioDev.getAbsolutePath() });
        asterixNCs[i] = new NodeControllerService(ncConfig);
        asterixNCs[i].start();
    }
    hcc = new HyracksConnection(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort());
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Starting CC in " + ccRoot.getAbsolutePath());
    }
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) File(java.io.File) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService) BeforeClass(org.junit.BeforeClass)

Example 14 with NodeControllerService

use of org.apache.hyracks.control.nc.NodeControllerService in project asterixdb by apache.

the class ReportMaxResourceIdMessage method send.

public static void send(NodeControllerService cs) throws HyracksDataException {
    NodeControllerService ncs = cs;
    INcApplicationContext appContext = (INcApplicationContext) ncs.getApplicationContext();
    long maxResourceId = Math.max(appContext.getLocalResourceRepository().maxId(), MetadataIndexImmutableProperties.FIRST_AVAILABLE_USER_DATASET_ID);
    ReportMaxResourceIdMessage maxResourceIdMsg = new ReportMaxResourceIdMessage(ncs.getId(), maxResourceId);
    try {
        ((INCMessageBroker) ncs.getContext().getMessageBroker()).sendMessageToCC(maxResourceIdMsg);
    } catch (Exception e) {
        LOGGER.log(Level.SEVERE, "Unable to report max local resource id", e);
        throw HyracksDataException.create(e);
    }
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) INCMessageBroker(org.apache.asterix.common.messaging.api.INCMessageBroker) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

NodeControllerService (org.apache.hyracks.control.nc.NodeControllerService)14 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)8 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)7 CCConfig (org.apache.hyracks.control.common.controllers.CCConfig)7 NCConfig (org.apache.hyracks.control.common.controllers.NCConfig)7 File (java.io.File)4 ArrayList (java.util.ArrayList)3 BeforeClass (org.junit.BeforeClass)3 IOException (java.io.IOException)2 INcApplicationContext (org.apache.asterix.common.api.INcApplicationContext)2 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)2 AsterixException (org.apache.asterix.common.exceptions.AsterixException)2 INCMessageBroker (org.apache.asterix.common.messaging.api.INCMessageBroker)2 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)2 CmdLineException (org.kohsuke.args4j.CmdLineException)2 NCAppRuntimeContext (org.apache.asterix.app.nc.NCAppRuntimeContext)1 AsterixThreadFactory (org.apache.asterix.common.api.AsterixThreadFactory)1 MessagingProperties (org.apache.asterix.common.config.MessagingProperties)1 TransactionProperties (org.apache.asterix.common.config.TransactionProperties)1 ILibraryManager (org.apache.asterix.common.library.ILibraryManager)1