Search in sources :

Example 1 with OnlineBackup

use of org.neo4j.backup.OnlineBackup in project neo4j by neo4j.

the class BackupLoad method doWorkOnMember.

@Override
protected void doWorkOnMember(boolean isCore, int id) {
    SocketAddress address = backupAddress.apply(isCore, id);
    File backupDirectory = new File(baseDirectory, Integer.toString(address.getPort()));
    OnlineBackup backup;
    try {
        backup = OnlineBackup.from(address.getHostname(), address.getPort()).backup(backupDirectory);
    } catch (RuntimeException e) {
        if (isTransientError.test(e)) {
            // if we could not connect, wait a bit and try again...
            LockSupport.parkNanos(10_000_000);
            return;
        }
        throw e;
    }
    if (!backup.isConsistent()) {
        throw new RuntimeException("Not consistent backup from " + address);
    }
}
Also used : OnlineBackup(org.neo4j.backup.OnlineBackup) SocketAddress(org.neo4j.helpers.SocketAddress) File(java.io.File)

Example 2 with OnlineBackup

use of org.neo4j.backup.OnlineBackup in project neo4j by neo4j.

the class RollingUpgradeIT method backup.

private void backup(int sourceServerId, File targetDir) throws UnknownHostException {
    OnlineBackup backup = OnlineBackup.from(localhost(), backupPort(sourceServerId)).backup(targetDir.getPath());
    assertTrue("Something wrong with the backup", backup.isConsistent());
}
Also used : OnlineBackup(org.neo4j.backup.OnlineBackup)

Aggregations

OnlineBackup (org.neo4j.backup.OnlineBackup)2 File (java.io.File)1 SocketAddress (org.neo4j.helpers.SocketAddress)1