Search in sources :

Example 1 with BackupOutcome

use of org.neo4j.backup.BackupService.BackupOutcome in project neo4j by neo4j.

the class BackupTool method main.

public static void main(String[] args) {
    System.err.println("WARNING: neo4j-backup is deprecated and support for it will be removed in a future\n" + "version of Neo4j; please use neo4j-admin backup instead.\n");
    BackupTool tool = new BackupTool(new BackupService(), System.out);
    try {
        BackupOutcome backupOutcome = tool.run(args);
        if (!backupOutcome.isConsistent()) {
            exitFailure("WARNING: The database is inconsistent.");
        }
    } catch (ToolFailureException e) {
        System.out.println("Backup failed.");
        exitFailure(e.getMessage());
    }
}
Also used : BackupOutcome(org.neo4j.backup.BackupService.BackupOutcome)

Example 2 with BackupOutcome

use of org.neo4j.backup.BackupService.BackupOutcome in project neo4j by neo4j.

the class BackupTool method executeBackup.

BackupOutcome executeBackup(HostnamePort hostnamePort, File to, ConsistencyCheck consistencyCheck, Config config, long timeout, boolean forensics) throws ToolFailureException {
    try {
        systemOut.println("Performing backup from '" + hostnamePort + "'");
        String host = hostnamePort.getHost();
        int port = hostnamePort.getPort();
        BackupOutcome outcome = backupService.doIncrementalBackupOrFallbackToFull(host, port, to, consistencyCheck, config, timeout, forensics);
        systemOut.println("Done");
        return outcome;
    } catch (UnexpectedStoreVersionException e) {
        throw new ToolFailureException(e.getMessage(), e);
    } catch (MismatchingStoreIdException e) {
        throw new ToolFailureException(String.format(MISMATCHED_STORE_ID, e.getExpected(), e.getEncountered()));
    } catch (ComException e) {
        throw new ToolFailureException("Couldn't connect to '" + hostnamePort + "'", e);
    } catch (IncrementalBackupNotPossibleException e) {
        throw new ToolFailureException(e.getMessage(), e);
    }
}
Also used : ComException(org.neo4j.com.ComException) UnexpectedStoreVersionException(org.neo4j.kernel.impl.store.UnexpectedStoreVersionException) BackupOutcome(org.neo4j.backup.BackupService.BackupOutcome) MismatchingStoreIdException(org.neo4j.kernel.impl.store.MismatchingStoreIdException)

Aggregations

BackupOutcome (org.neo4j.backup.BackupService.BackupOutcome)2 ComException (org.neo4j.com.ComException)1 MismatchingStoreIdException (org.neo4j.kernel.impl.store.MismatchingStoreIdException)1 UnexpectedStoreVersionException (org.neo4j.kernel.impl.store.UnexpectedStoreVersionException)1