Search in sources :

Example 6 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.

the class AsterixHyracksIntegrationUtil method createNCConfig.

protected NCConfig createNCConfig(String ncName, ConfigManager configManager) {
    NCConfig ncConfig = new NCConfig(ncName, configManager);
    ncConfig.setClusterAddress("localhost");
    ncConfig.setClusterPort(DEFAULT_HYRACKS_CC_CLUSTER_PORT);
    ncConfig.setClusterListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
    ncConfig.setDataListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
    ncConfig.setResultListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
    ncConfig.setMessagingListenAddress(Inet4Address.getLoopbackAddress().getHostAddress());
    ncConfig.setResultTTL(120000L);
    ncConfig.setResultSweepThreshold(1000L);
    ncConfig.setVirtualNC(true);
    configManager.set(ControllerConfig.Option.DEFAULT_DIR, joinPath(getDefaultStoragePath(), "asterixdb", ncName));
    return ncConfig;
}
Also used : NCConfig(org.apache.hyracks.control.common.controllers.NCConfig)

Example 7 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig in project asterixdb by apache.

the class NCApplication method updateOnNodeJoin.

private void updateOnNodeJoin() {
    MetadataProperties metadataProperties = runtimeContext.getMetadataProperties();
    if (!metadataProperties.getNodeNames().contains(nodeId)) {
        Cluster cluster = ClusterProperties.INSTANCE.getCluster();
        if (cluster == null) {
            throw new IllegalStateException("No cluster configuration found for this instance");
        }
        NCConfig ncConfig = ((NodeControllerService) ncServiceCtx.getControllerService()).getConfiguration();
        ncConfig.getConfigManager().registerVirtualNode(nodeId);
        String asterixInstanceName = metadataProperties.getInstanceName();
        TransactionProperties txnProperties = runtimeContext.getTransactionProperties();
        Node self = null;
        List<Node> nodes;
        if (cluster.getSubstituteNodes() != null) {
            nodes = cluster.getSubstituteNodes().getNode();
        } else {
            throw new IllegalStateException("Unknown node joining the cluster");
        }
        for (Node node : nodes) {
            String ncId = asterixInstanceName + "_" + node.getId();
            if (ncId.equalsIgnoreCase(nodeId)) {
                String storeDir = ClusterProperties.INSTANCE.getStorageDirectoryName();
                String nodeIoDevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
                String[] ioDevicePaths = nodeIoDevices.trim().split(",");
                for (int i = 0; i < ioDevicePaths.length; i++) {
                    // construct full store path
                    ioDevicePaths[i] += File.separator + storeDir;
                }
                metadataProperties.getStores().put(nodeId, ioDevicePaths);
                String coredumpPath = node.getLogDir() == null ? cluster.getLogDir() : node.getLogDir();
                metadataProperties.getCoredumpPaths().put(nodeId, coredumpPath);
                String txnLogDir = node.getTxnLogDir() == null ? cluster.getTxnLogDir() : node.getTxnLogDir();
                txnProperties.getLogDirectories().put(nodeId, txnLogDir);
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.info("Store set to : " + storeDir);
                    LOGGER.info("Coredump dir set to : " + coredumpPath);
                    LOGGER.info("Transaction log dir set to :" + txnLogDir);
                }
                self = node;
                break;
            }
        }
        if (self != null) {
            cluster.getSubstituteNodes().getNode().remove(self);
            cluster.getNode().add(self);
        } else {
            throw new IllegalStateException("Unknown node joining the cluster");
        }
    }
}
Also used : NodeControllerService(org.apache.hyracks.control.nc.NodeControllerService) NCConfig(org.apache.hyracks.control.common.controllers.NCConfig) TransactionProperties(org.apache.asterix.common.config.TransactionProperties) Node(org.apache.asterix.event.schema.cluster.Node) Cluster(org.apache.asterix.event.schema.cluster.Cluster) MetadataProperties(org.apache.asterix.common.config.MetadataProperties)

Example 8 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig 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 9 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig 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 10 with NCConfig

use of org.apache.hyracks.control.common.controllers.NCConfig 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)

Aggregations

NCConfig (org.apache.hyracks.control.common.controllers.NCConfig)11 NodeControllerService (org.apache.hyracks.control.nc.NodeControllerService)7 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)6 ClusterControllerService (org.apache.hyracks.control.cc.ClusterControllerService)6 CCConfig (org.apache.hyracks.control.common.controllers.CCConfig)6 File (java.io.File)4 BeforeClass (org.junit.BeforeClass)3 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)2 IOException (java.io.IOException)1 MetadataProperties (org.apache.asterix.common.config.MetadataProperties)1 TransactionProperties (org.apache.asterix.common.config.TransactionProperties)1 Cluster (org.apache.asterix.event.schema.cluster.Cluster)1 Node (org.apache.asterix.event.schema.cluster.Node)1 INCApplication (org.apache.hyracks.api.application.INCApplication)1 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)1 NodeCapacity (org.apache.hyracks.api.job.resource.NodeCapacity)1 ConfigManager (org.apache.hyracks.control.common.config.ConfigManager)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1