Search in sources :

Example 6 with CCConfig

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());
    }
}
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 7 with CCConfig

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;
}
Also used : CCConfig(org.apache.hyracks.control.common.controllers.CCConfig)

Example 8 with 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()]);
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) INCApplication(org.apache.hyracks.api.application.INCApplication) ArrayList(java.util.ArrayList) ConfigManager(org.apache.hyracks.control.common.config.ConfigManager) AsterixException(org.apache.asterix.common.exceptions.AsterixException) IOException(java.io.IOException) CmdLineException(org.kohsuke.args4j.CmdLineException) ICCApplication(org.apache.hyracks.api.application.ICCApplication) CCConfig(org.apache.hyracks.control.common.controllers.CCConfig) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) ClusterControllerService(org.apache.hyracks.control.cc.ClusterControllerService)

Example 9 with CCConfig

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);
}
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 10 with CCConfig

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

Aggregations

CCConfig (org.apache.hyracks.control.common.controllers.CCConfig)13 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)8 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)7 NodeControllerService (org.apache.hyracks.control.nc.NodeControllerService)7 NCConfig (org.apache.hyracks.control.common.controllers.NCConfig)6 File (java.io.File)4 BeforeClass (org.junit.BeforeClass)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 ICCApplication (org.apache.hyracks.api.application.ICCApplication)2 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)2 ConfigManager (org.apache.hyracks.control.common.config.ConfigManager)2 CmdLineException (org.kohsuke.args4j.CmdLineException)2 ActiveLifecycleListener (org.apache.asterix.active.ActiveLifecycleListener)1 StatementExecutorContext (org.apache.asterix.api.http.ctx.StatementExecutorContext)1 CCExtensionManager (org.apache.asterix.app.cc.CCExtensionManager)1 ResourceIdManager (org.apache.asterix.app.cc.ResourceIdManager)1 AsterixThreadFactory (org.apache.asterix.common.api.AsterixThreadFactory)1 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)1 IStorageComponentProvider (org.apache.asterix.common.context.IStorageComponentProvider)1