Search in sources :

Example 1 with Nodeid

use of org.apache.asterix.event.schema.pattern.Nodeid in project asterixdb by apache.

the class PatternCreator method createCopyHyracksPattern.

private Pattern createCopyHyracksPattern(String instanceName, Cluster cluster, String destinationIp, String destDir) {
    Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
    String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
    String asterixZipName = AsterixEventService.getAsterixZip().substring(AsterixEventService.getAsterixZip().lastIndexOf(File.separator) + 1);
    String fileToTransfer = new File(AsterixEventService.getAsterixDir() + File.separator + instanceName + File.separator + asterixZipName).getAbsolutePath();
    String pargs = username + " " + fileToTransfer + " " + destinationIp + " " + destDir + " " + "unpack";
    Event event = new Event("file_transfer", nodeid, pargs);
    return new Pattern(null, 1, null, event);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Event(org.apache.asterix.event.schema.pattern.Event) File(java.io.File)

Example 2 with Nodeid

use of org.apache.asterix.event.schema.pattern.Nodeid in project asterixdb by apache.

the class PatternCreator method getHDFSBackUpAsterixPattern.

private Patterns getHDFSBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
    Cluster cluster = instance.getCluster();
    String hdfsUrl = backupConf.getHdfs().getUrl();
    String hadoopVersion = backupConf.getHdfs().getVersion();
    String hdfsBackupDir = backupConf.getBackupDir();
    VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
    String workingDir = cluster.getWorkingDir().getDir();
    String backupId = Integer.toString(instance.getBackupInfo().size());
    String store;
    String pargs;
    String iodevices;
    store = cluster.getStore();
    List<Pattern> patternList = new ArrayList<>();
    for (Node node : cluster.getNode()) {
        Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
        iodevices = node.getIodevices() == null ? instance.getCluster().getIodevices() : node.getIodevices();
        pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " " + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " " + backupId + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
        Event event = new Event("backup", nodeid, pargs);
        patternList.add(new Pattern(null, 1, null, event));
    }
    return new Patterns(patternList);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Node(org.apache.asterix.event.schema.cluster.Node) ArrayList(java.util.ArrayList) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Cluster(org.apache.asterix.event.schema.cluster.Cluster) Event(org.apache.asterix.event.schema.pattern.Event) Patterns(org.apache.asterix.event.schema.pattern.Patterns)

Example 3 with Nodeid

use of org.apache.asterix.event.schema.pattern.Nodeid in project asterixdb by apache.

the class PatternCreator method getHDFSRestoreAsterixPattern.

public Patterns getHDFSRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
    Cluster cluster = instance.getCluster();
    String clusterStore = instance.getCluster().getStore();
    String hdfsUrl = backupInfo.getBackupConf().getHdfs().getUrl();
    String hadoopVersion = backupInfo.getBackupConf().getHdfs().getVersion();
    String hdfsBackupDir = backupInfo.getBackupConf().getBackupDir();
    VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
    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 + " " + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
        Event event = new Event("restore", nodeid, pargs);
        patternList.add(new Pattern(null, 1, null, event));
    }
    return new Patterns(patternList);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Node(org.apache.asterix.event.schema.cluster.Node) ArrayList(java.util.ArrayList) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Cluster(org.apache.asterix.event.schema.cluster.Cluster) Event(org.apache.asterix.event.schema.pattern.Event) Patterns(org.apache.asterix.event.schema.pattern.Patterns)

Example 4 with Nodeid

use of org.apache.asterix.event.schema.pattern.Nodeid 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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Node(org.apache.asterix.event.schema.cluster.Node) ArrayList(java.util.ArrayList) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Cluster(org.apache.asterix.event.schema.cluster.Cluster) Event(org.apache.asterix.event.schema.pattern.Event) Patterns(org.apache.asterix.event.schema.pattern.Patterns)

Example 5 with Nodeid

use of org.apache.asterix.event.schema.pattern.Nodeid 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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Event(org.apache.asterix.event.schema.pattern.Event)

Aggregations

Nodeid (org.apache.asterix.event.schema.pattern.Nodeid)22 Pattern (org.apache.asterix.event.schema.pattern.Pattern)22 Value (org.apache.asterix.event.schema.pattern.Value)22 Event (org.apache.asterix.event.schema.pattern.Event)21 ArrayList (java.util.ArrayList)17 Patterns (org.apache.asterix.event.schema.pattern.Patterns)17 Node (org.apache.asterix.event.schema.cluster.Node)16 Cluster (org.apache.asterix.event.schema.cluster.Cluster)13 File (java.io.File)5 FileOutputStream (java.io.FileOutputStream)1 HashMap (java.util.HashMap)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1