Neo4j Enterprise

org.neo4j.backup
Class OnlineBackup

java.lang.Object
  extended by org.neo4j.backup.OnlineBackup

public class OnlineBackup
extends Object

This class encapsulates the information needed to perform an online backup against a running Neo4j instance configured to act as a backup server. This class is not instantiable, instead factory methods are used to get instances configured to contact a specific backup server against which all possible backup operations can be performed. All backup methods return the same instance, allowing for chaining calls.


Method Summary
static OnlineBackup from(String hostNameOrIp)
          Factory method for this class.
static OnlineBackup from(String hostNameOrIp, int port)
          Factory method for this class.
 OnlineBackup full(String targetDirectory)
          Performs a full backup storing the resulting database at the given directory.
 OnlineBackup full(String targetDirectory, boolean verification)
          Performs a full backup storing the resulting database at the given directory.
 OnlineBackup full(String targetDirectory, boolean verification, org.neo4j.kernel.configuration.Config tuningConfiguration)
          Performs a full backup storing the resulting database at the given directory.
 Map<String,Long> getLastCommittedTxs()
          Provides information about the last committed transaction for each data source present in the last backup operation performed by this OnlineBackup.
 OnlineBackup incremental(GraphDatabaseAPI targetDb)
          Performs an incremental backup on the supplied target database.
 OnlineBackup incremental(String targetDirectory)
          Performs an incremental backup on the database stored in targetDirectory.
 OnlineBackup incremental(String targetDirectory, boolean verification)
          Performs an incremental backup on the database stored in targetDirectory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

from

public static OnlineBackup from(String hostNameOrIp,
                                int port)
Factory method for this class. The OnlineBackup instance returned will perform backup operations against the hostname and port passed in as parameters.

Parameters:
hostNameOrIp - The hostname or the IP address of the backup server
port - The port at which the remote backup server is listening
Returns:
An OnlineBackup instance ready to perform backup operations from the given remote server

from

public static OnlineBackup from(String hostNameOrIp)
Factory method for this class. The OnlineBackup instance returned will perform backup operations against the hostname passed in as parameter, using the default backup port.

Parameters:
hostNameOrIp - The hostname or IP address of the backup server
Returns:
An OnlineBackup instance ready to perform backup operations from the given remote server

full

public OnlineBackup full(String targetDirectory)
Performs a full backup storing the resulting database at the given directory. The server contacted is the one configured in the factory method used to obtain this instance. At the end of the backup, a verification phase will take place, running over the resulting database ensuring it is consistent. If the check fails, the fact will be printed in stderr. If the target directory already contains a database, a RuntimeException denoting the fact will be thrown.

Parameters:
targetDirectory - The directory in which to store the database
Returns:
The same OnlineBackup instance, possible to use for a new backup operation.

full

public OnlineBackup full(String targetDirectory,
                         boolean verification)
Performs a full backup storing the resulting database at the given directory. The server contacted is the one configured in the factory method used to obtain this instance. If the verification flag is set, at the end of the backup, a verification phase will take place, running over the resulting database ensuring it is consistent. If the check fails, the fact will be printed in stderr. If the target directory already contains a database, a RuntimeException denoting the fact will be thrown.

Parameters:
targetDirectory - The directory in which to store the database
verification - a boolean indicating whether to perform verification on the created backup
Returns:
The same OnlineBackup instance, possible to use for a new backup operation.

full

public OnlineBackup full(String targetDirectory,
                         boolean verification,
                         org.neo4j.kernel.configuration.Config tuningConfiguration)
Performs a full backup storing the resulting database at the given directory. The server contacted is the one configured in the factory method used to obtain this instance. If the verification flag is set, at the end of the backup, a verification phase will take place, running over the resulting database ensuring it is consistent. If the check fails, the fact will be printed in stderr. The consistency check will run with the provided tuning configuration. If the target directory already contains a database, a RuntimeException denoting the fact will be thrown.

Parameters:
targetDirectory - The directory in which to store the database
verification - a boolean indicating whether to perform verification on the created backup
tuningConfiguration - The Config to use when running the consistency check
Returns:
The same OnlineBackup instance, possible to use for a new backup operation.

incremental

public OnlineBackup incremental(String targetDirectory)
Performs an incremental backup on the database stored in targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the incremental backup is complete, a verification phase will take place, checking the database for consistency. If any errors are found, they will be printed in stderr. If the target directory does not contain a database or it is not compatible with the one present in the configured backup server a RuntimeException will be thrown denoting the fact.

Parameters:
targetDirectory - A directory holding a complete database previously obtained from the backup server.
Returns:
The same OnlineBackup instance, possible to use for a new backup operation

incremental

public OnlineBackup incremental(String targetDirectory,
                                boolean verification)
Performs an incremental backup on the database stored in targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the incremental backup is complete, and if the verification parameter is set to true, a verification phase will take place, checking the database for consistency. If any errors are found, they will be printed in stderr. If the target directory does not contain a database or it is not compatible with the one present in the configured backup server a RuntimeException will be thrown denoting the fact.

Parameters:
targetDirectory - A directory holding a complete database previously obtained from the backup server.
verification - If true, the verification phase will be run.
Returns:
The same OnlineBackup instance, possible to use for a new backup operation

incremental

public OnlineBackup incremental(GraphDatabaseAPI targetDb)
Performs an incremental backup on the supplied target database. The server contacted is the one configured in the factory method used to obtain this instance. After the incremental backup is complete a verification phase will take place, checking the database for consistency. If any errors are found, they will be printed in stderr. If the target database is not compatible with the one present in the target backup server, a RuntimeException will be thrown denoting the fact.

Parameters:
targetDb - The database on which the incremental backup is to be applied
Returns:
The same OnlineBackup instance, possible to use for a new backup operation.

getLastCommittedTxs

public Map<String,Long> getLastCommittedTxs()
Provides information about the last committed transaction for each data source present in the last backup operation performed by this OnlineBackup. In particular, it returns a map where the keys are the names of the data sources and the values the longs that are the last committed transaction id for that data source.

Returns:
A map from data source name to last committed transaction id.

Neo4j Enterprise

Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.