org.neo4j.backup

Class 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 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

        @Deprecated
        public OnlineBackup backup(String targetDirectory)
        Deprecated. use backup(File) instead
        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(File 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

        @Deprecated
        public OnlineBackup backup(String targetDirectory,
                                               boolean verification)
        Deprecated. use backup(File, boolean) instead
        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(File 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

        @Deprecated
        public OnlineBackup backup(String targetDirectory,
                                               org.neo4j.kernel.configuration.Config tuningConfiguration)
        Deprecated. use backup(File, Config) instead
        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(File 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

        @Deprecated
        public OnlineBackup backup(String targetDirectory,
                                               org.neo4j.kernel.configuration.Config tuningConfiguration,
                                               boolean verification)
        Deprecated. use backup(File, Config, boolean) instead
        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.
      • backup

        public OnlineBackup backup(File 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.
      • withTimeout

        public OnlineBackup withTimeout(long timeoutMillis)
        Use this method to change the default timeout to keep the client waiting for each reply from the server when doing online backup. Once the value is changed, then every time when doing online backup, the timeout will be reused until this method is called again and a new value is assigned.
        Parameters:
        timeoutMillis - The time duration in millisecond that keeps the client waiting for each reply from the server.
        Returns:
        The same OnlineBackup instance, possible to use for a new backup operation.
      • full

        @Deprecated
        public OnlineBackup full(String targetDirectory)
        Deprecated. Use backup(File) 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(File, 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(File, 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(File) 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(File, 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(org.neo4j.kernel.internal.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.
      • getLastCommittedTx

        public long getLastCommittedTx()
        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
      • gatheringForensics

        public OnlineBackup gatheringForensics(boolean forensics)
        Parameters:
        forensics - whether or not additional information should be backed up, for example transaction
        Returns:
        The same OnlineBackup instance, possible to use for a new backup operation

Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.