Neo4j

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
 OnlineBackup backup(String targetDirectory)
          Performs a backup into targetDirectory.
 OnlineBackup backup(String targetDirectory, boolean verification)
          Performs a backup into targetDirectory.
 OnlineBackup backup(String targetDirectory, org.neo4j.kernel.configuration.Config tuningConfiguration)
          Performs a backup into targetDirectory.
 OnlineBackup backup(String targetDirectory, org.neo4j.kernel.configuration.Config tuningConfiguration, boolean verification)
          Performs a backup into targetDirectory.
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)
          Deprecated. Use backup(String) instead.
 OnlineBackup full(String targetDirectory, boolean verification)
          Deprecated. Use backup(String, boolean) instead
 OnlineBackup full(String targetDirectory, boolean verification, org.neo4j.kernel.configuration.Config tuningConfiguration)
          Deprecated. Use backup(String, Config, boolean) instead.
 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)
          Deprecated. Use backup(String) instead.
 OnlineBackup incremental(String targetDirectory)
          Deprecated. Use backup(String) instead.
 OnlineBackup incremental(String targetDirectory, boolean verification)
          Deprecated. Use backup(String, boolean) instead.
 boolean isConsistent()
           
 
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

backup

public OnlineBackup backup(String targetDirectory)
Performs a backup into targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the 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, a full backup will be performed, otherwise an incremental backup mechanism is used. If the backup has become too far out of date for an incremental backup to succeed, a full backup is performed.

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

backup

public OnlineBackup backup(String targetDirectory,
                           boolean verification)
Performs a backup into targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the 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, a full backup will be performed, otherwise an incremental backup mechanism is used. If the backup has become too far out of date for an incremental backup to succeed, a full backup is performed.

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

backup

public OnlineBackup backup(String targetDirectory,
                           org.neo4j.kernel.configuration.Config tuningConfiguration)
Performs a backup into targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the 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, a full backup will be performed, otherwise an incremental backup mechanism is used. If the backup has become too far out of date for an incremental backup to succeed, a full backup is performed.

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

backup

public OnlineBackup backup(String targetDirectory,
                           org.neo4j.kernel.configuration.Config tuningConfiguration,
                           boolean verification)
Performs a backup into targetDirectory. The server contacted is the one configured in the factory method used to obtain this instance. After the 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, a full backup will be performed, otherwise an incremental backup mechanism is used. If the backup has become too far out of date for an incremental backup to succeed, a full backup is performed.

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

full

@Deprecated
public OnlineBackup full(String targetDirectory)
Deprecated. Use backup(String) instead.

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

@Deprecated
public OnlineBackup full(String targetDirectory,
                                    boolean verification)
Deprecated. Use backup(String, boolean) instead

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

@Deprecated
public OnlineBackup full(String targetDirectory,
                                    boolean verification,
                                    org.neo4j.kernel.configuration.Config tuningConfiguration)
Deprecated. Use backup(String, Config, boolean) instead.

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

@Deprecated
public OnlineBackup incremental(String targetDirectory)
Deprecated. Use backup(String) instead.

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

@Deprecated
public OnlineBackup incremental(String targetDirectory,
                                           boolean verification)
Deprecated. Use backup(String, boolean) instead.

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

@Deprecated
public OnlineBackup incremental(GraphDatabaseAPI targetDb)
Deprecated. Use backup(String) instead.

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.

isConsistent

public boolean isConsistent()
Returns:
the consistency outcome of the last made backup. I

Neo4j

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