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