use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method getLocalRestoreAsterixPattern.
public Patterns getLocalRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
Cluster cluster = instance.getCluster();
String clusterStore = instance.getCluster().getStore();
String backupDir = backupInfo.getBackupConf().getBackupDir();
String workingDir = cluster.getWorkingDir().getDir();
int backupId = backupInfo.getId();
String pargs;
List<Pattern> patternList = new ArrayList<>();
for (Node node : cluster.getNode()) {
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + clusterStore + " " + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " " + backupId + " " + backupDir + " " + "local" + " " + node.getId();
Event event = new Event("restore", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
}
return new Patterns(patternList);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method getStartAsterixPattern.
public Patterns getStartAsterixPattern(String asterixInstanceName, Cluster cluster, boolean createCommand) throws Exception {
String ccLocationId = cluster.getMasterNode().getId();
List<Pattern> ps = new ArrayList<>();
Pattern createCC = createCCStartPattern(ccLocationId);
addInitialDelay(createCC, 3, "sec");
ps.add(createCC);
for (Node node : cluster.getNode()) {
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
Pattern createNC = createNCStartPattern(cluster.getMasterNode().getClusterIp(), node.getId(), asterixInstanceName + "_" + node.getId(), iodevices, createCommand);
addInitialDelay(createNC, 5, "sec");
ps.add(createNC);
}
return new Patterns(ps);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createCCStopPattern.
public Pattern createCCStopPattern(String hostId) {
Nodeid nodeid = new Nodeid(new Value(null, hostId));
Event event = new Event("cc_failure", nodeid, null);
return new Pattern(null, 1, null, event);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createPrepareNodePattern.
public Patterns createPrepareNodePattern(String instanceName, Cluster cluster, Node nodeToBeAdded) {
List<Pattern> ps = new ArrayList<>();
boolean workingDirOnNFS = cluster.getWorkingDir().isNFS();
if (!workingDirOnNFS) {
String ccLocationIp = cluster.getMasterNode().getClusterIp();
String destDir = cluster.getWorkingDir().getDir() + File.separator + "asterix";
Pattern copyHyracks = createCopyHyracksPattern(instanceName, cluster, ccLocationIp, destDir);
ps.add(copyHyracks);
String workingDir = cluster.getWorkingDir().getDir();
String hadoopVersion = AsterixEventService.getConfiguration().getBackup().getHdfs().getVersion();
File hadoopDir = new File(AsterixEventService.getEventHome() + File.separator + "hadoop-" + hadoopVersion);
if (!hadoopDir.exists()) {
throw new IllegalStateException("Hadoop version :" + hadoopVersion + " not supported");
}
Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
String pargs = username + " " + hadoopDir.getAbsolutePath() + " " + cluster.getMasterNode().getClusterIp() + " " + workingDir;
Event event = new Event("directory_transfer", nodeid, pargs);
Pattern p = new Pattern(null, 1, null, event);
addInitialDelay(p, 2, "sec");
ps.add(p);
nodeid = new Nodeid(new Value(null, nodeToBeAdded.getId()));
pargs = cluster.getUsername() + " " + hadoopDir.getAbsolutePath() + " " + nodeToBeAdded.getClusterIp() + " " + workingDir;
event = new Event("directory_transfer", nodeid, pargs);
p = new Pattern(null, 1, null, event);
addInitialDelay(p, 2, "sec");
ps.add(p);
}
return new Patterns(ps);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createNCStopPattern.
public Pattern createNCStopPattern(String hostId, String nodeControllerId) {
Nodeid nodeid = new Nodeid(new Value(null, hostId));
Event event = new Event("node_failure", nodeid, nodeControllerId);
return new Pattern(null, 1, null, event);
}
Aggregations