use of org.apache.asterix.event.model.AsterixInstance in project asterixdb by apache.
the class AsterixInstallerIntegrationUtil method deleteInstance.
private static void deleteInstance() throws Exception {
String command = null;
AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(ASTERIX_INSTANCE_NAME);
if (instance == null) {
return;
} else {
transformIntoRequiredState(State.INACTIVE);
command = "delete -n " + ASTERIX_INSTANCE_NAME;
cmdHandler.processCommand(command.split(" "));
}
instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(ASTERIX_INSTANCE_NAME);
assert (instance == null);
}
use of org.apache.asterix.event.model.AsterixInstance in project asterixdb by apache.
the class AsterixInstallerIntegrationUtil method createInstance.
public static void createInstance() throws Exception {
String command = null;
AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(ASTERIX_INSTANCE_NAME);
if (instance != null) {
transformIntoRequiredState(State.INACTIVE);
command = "delete -n " + ASTERIX_INSTANCE_NAME;
cmdHandler.processCommand(command.split(" "));
}
command = "create -n " + ASTERIX_INSTANCE_NAME + " " + "-c" + " " + clusterConfigurationPath;
cmdHandler.processCommand(command.split(" "));
instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(ASTERIX_INSTANCE_NAME);
AsterixRuntimeState state = VerificationUtil.getAsterixRuntimeState(instance);
assert (state.getFailedNCs().isEmpty() && state.isCcRunning());
}
use of org.apache.asterix.event.model.AsterixInstance in project asterixdb by apache.
the class ZookeeperUtil method readAsterixInstanceObject.
private AsterixInstance readAsterixInstanceObject(byte[] asterixInstanceBytes) throws IOException, ClassNotFoundException {
ByteArrayInputStream b = new ByteArrayInputStream(asterixInstanceBytes);
ObjectInputStream ois = new ObjectInputStream(b);
return (AsterixInstance) ois.readObject();
}
use of org.apache.asterix.event.model.AsterixInstance in project asterixdb by apache.
the class ClusterManager method addNode.
@Override
public void addNode(ICcApplicationContext appCtx, Node node) throws AsterixException {
try {
Cluster cluster = ClusterProperties.INSTANCE.getCluster();
List<Pattern> pattern = new ArrayList<>();
String asterixInstanceName = appCtx.getMetadataProperties().getInstanceName();
Patterns prepareNode = PatternCreator.INSTANCE.createPrepareNodePattern(asterixInstanceName, ClusterProperties.INSTANCE.getCluster(), node);
cluster.getNode().add(node);
client.submit(prepareNode);
ExternalProperties externalProps = appCtx.getExternalProperties();
AsterixEventServiceUtil.poulateClusterEnvironmentProperties(cluster, externalProps.getCCJavaParams(), externalProps.getNCJavaParams());
pattern.clear();
String ccHost = cluster.getMasterNode().getClusterIp();
String hostId = node.getId();
String nodeControllerId = asterixInstanceName + "_" + node.getId();
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
Pattern startNC = PatternCreator.INSTANCE.createNCStartPattern(ccHost, hostId, nodeControllerId, iodevices, false);
pattern.add(startNC);
Patterns startNCPattern = new Patterns(pattern);
client.submit(startNCPattern);
removeNode(cluster.getSubstituteNodes().getNode(), node);
AsterixInstance instance = lookupService.getAsterixInstance(cluster.getInstanceName());
instance.getCluster().getNode().add(node);
removeNode(instance.getCluster().getSubstituteNodes().getNode(), node);
lookupService.updateAsterixInstance(instance);
} catch (Exception e) {
throw new AsterixException(e);
}
}
use of org.apache.asterix.event.model.AsterixInstance in project asterixdb by apache.
the class UninstallConfig method execCommand.
@Override
protected void execCommand() throws Exception {
InstallerDriver.initConfig(true);
UninstallConfig uninstallConfig = ((UninstallConfig) config);
String instanceName = uninstallConfig.name;
AsterixEventServiceUtil.validateAsterixInstanceExists(instanceName, State.INACTIVE);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
AsterixInstance instance = lookupService.getAsterixInstance(instanceName);
PatternCreator pc = PatternCreator.INSTANCE;
Patterns patterns = pc.getLibraryUninstallPattern(instance, uninstallConfig.dataverseName, uninstallConfig.libraryName);
AsterixEventServiceClient client = AsterixEventService.getAsterixEventServiceClient(instance.getCluster());
client.submit(patterns);
LOGGER.info("Uninstalled library " + uninstallConfig.libraryName);
}
Aggregations