Running database upload / push-to-cloud to load a database dump file to Neo4j AuraMay 20, 2024Knowledge
Article DetailsDetailsHelp DetailsWith the ability to download a database Dump from Aura instances, you have another tool along with Backup/Restore to manage your data and use it flexibly in Aura and on-premise. In this case, we want to download a database Dump from an existing AuraDB instance and load it to another (or it could be the same) instance. This way, you can roll back your AuraDB Instance to a previous state (note that a dump is a snapshot and not a full backup) or decide to do some development and test on a duplicate of your current AuraDB Instance, etc... The procedure can be applied to both AuraDB and AuraDS instances. Depending on the version, the procedure for using the command line tool Neo4j 4.4.x :neo4j-admin push-to-cloud command line available in local installations of Neo4j 4 and earlier.Neo4j 5.x : please refer to the Using 'neo4j-admin database upload' in Neo4j 5.x to load a database dump to Neo4j Aura article. Prerequisites: A Neo4j Aura instance must already be provisioned and running.console.neo4j.io has to be accessible from the machine running neo4j-admin. Important Note on compatibility between different source and destination versions of Neo4j:Neo4j Aura-5 instances(Destination) are backwards compatible and can accept backups from Neo4j 4.4.x and Neo4j 5.x (Source).Neo4j Aura-4 instances(Destination) are not forward-compatible. i.e. You can import backups from Neo4j 5.x and Neo4j 4.4.x into an Aura-5 instance.You can import backups from Neo4j 4.4.x into an Aura-4 instance.You cannot import backups from Neo4j 5.x instances into an Aura-4. instance. The process can be split into five steps: Download a database DumpDownload the Export (a.k.a Dump file) locally to your machine.Verify/Prepare your local Neo4j installation has the neo4j-admin tool.Run the push-to-cloud command.Monitor the status and availability of your Aura Instance during the upload. 1 - Download a database Dump (also called an Export). Click the Aura Instance name in the Aura console, open up the SNAPSHOTS tab, and download the dump file. 2 - Download the Export (a.k.a Dump file) locally to your machine. Download time is dependent on the dump file size (compressed datastore size) and, of course, your connection speed.Note that the file will ultimately be saved as neo4j.dump locally (you can rename it but keep the file extension) Note for AuraDS instances: Snapshots from AuraDS instances will be a tar file that contains the instance's dump and GDS metadata.Extract the .tar archive to get the 'neo4j.dump' file. 3 - Verify/Prepare your local Neo4j installation has the neo4j-admin tool. You will need a Neo4j installation. The easiest option is to use the Neo4j Desktop to achieve this, as the push-to-cloud jar file is present by default. If you use Neo4j Desktop, access the settings from a 5.x database and select Terminal. This will open the terminal directly into the database's NEO4J_HOME directory. To upload a dump file from other on-premise installations, you will need push-to-cloud (it should be present), please be sure to use the correct version of the binaries for the Neo4j version you are running or download them if required. a - Dump file from a Neo4j v3.5.x (or v3.6.x in Aura) You will first need to locally upgrade the database to 4.4.latest first. The best method to achieve this is to proceed with the neo4j-admin tools and proceed to copy. See more details here b - Dump file from a Neo4j v4.0.x up to 4.3.x For best results you should locally first update to 4.4.latest using the neo4j-admin copy. See more details here. c - Dump file from a Neo4j v4.4.x (or Aura-4) The root/base directory of your Neo4j installation is referred as NEO4J_HOME and you should place the binaries in <NEO4J_HOME>/libTo verify if push to cloud is present and can run, execute:<NEO4J_HOME>/bin/neo4j-admin help push-to-cloud 4 - Run the push-to-cloud command Now that everything is ready, we can run the command to upload the dump.We will need the AuraDB Instance URI (neo4j+s//<your_dbid>.databases.neo4j.io) as can be seen in the Aura console and your password (this is the password to the AuraDB Instance - not your Aura Console credentials). If you intend on creating a new AuraDB Instance, you need to do so now before you can run the command. The minimal set you will need to provide is (this means you will need to provide further info in interactive mode, like the username and password and confirmation you want to overwrite the content) push-to-cloud --bolt-uri=neo4j+s://<dbid>.databases.neo4j.io --dump=/path/to/dumpfile/graph.db Example: Note: in this example, we have included the password on the command line but you can set it via environment variables (NEO4J_USERNAME, NEO4J_PASSWORD) or use the interactive mode for better security user@hostname:installation-4.4.18$ bin/neo4j-admin push-to-cloud \--bolt-uri=neo4j+s://ac43ded9.databases.neo4j.io \--dump=/home/username/Downloads/neo4j.dump \--username=neo4j \--password='U1JQFOX5_wgdwptm41PkHLekUBtDZ0y_7QX51RQuncU' \--overwrite=true Upload.................... 10%.................... 20%.................... 30%.................... 40%.................... 50%.................... 60%.................... 70%.................... 80%.................... 90%.................... 100%We have received your export and it is currently being loaded into your AuraDB instance.You can wait here, or abort this command and head over to the console to be notified of when your AuraDB Instance is running.Import progress (estimated).................... 10%.................... 20%.................... 30%.................... 40%.................... 50%.................... 60%.................... 70%.................... 80%.................... 90%.................... 100%Your data was successfully pushed to AuraDB and is now running.It is safe to delete the dump file now: /home/username/Downloads/neo4j.dump 5 - Monitor the status and availability of your AuraDB Instance in the Aura console While the dump file is uploading the AuraDB Instance is still marked as Running. Then the AuraDB Instance will display Loading And when it is complete you will see Running status again Additional notes If you use the --database switch the command assumes this is for the local database instance and will search in the matching dump location For full options of the push-to-cloud command see the help: user@hostname:$ bin/neo4j-admin help push-to-cloudusage: neo4j-admin push-to-cloud [--database=<name>][--dump=</path/to/my-neo4j-database-dump-file>][--dump-to=</path/to/dump-file-to-be-created>]--bolt-uri=<bolt+routing://mydatabaseid.databases.neo4j.io>[--verbose] [--username=<neo4j>][--password=<mYs3cr3tPa$$w0rd>][--overwrite=<true/false>] environment variables:NEO4J_CONF Path to the directory which contains neo4j.conf.NEO4J_DEBUG Set to anything to enable debug output.NEO4J_HOME Neo4j home directory.HEAP_SIZE Set JVM maximum heap size during command execution.Takes a number and a unit, for example, 512m. Push your local database to a Neo4j AuraDB instance. The database must be shut downin order to take a dump to upload. The target location is your Neo4j AuraDB BoltURI. You will be asked your Neo4j Cloud username and password during thepush-to-cloud operation. options:--database=<name>Name of database. [default:graph.db]--dump=</path/to/my-neo4j-database-dump-file>Path to an existing database dump for upload. This arugment cannot be usedtogether with --database. [default:null]--dump-to=</path/to/dump-file-to-be-created>Target path for dump file. Used in combination with the --databaseargument. [default:null]--bolt-uri=<bolt+routing://mydatabaseid.databases.neo4j.io>Bolt URI of target AuraDB Instance--verboseEnable verbose output.--username=<neo4j>Optional: Username of the target AuraDB Instance. Promptwill ask for the username if not provided. Alternatively, NEO4J_USERNAMEenvironment variable can be used. [default:null]--password=<mYs3cr3tPa$$w0rd>Optional: Password of the target AuraDB Instance. Promptwill ask for a password if not provided. Alternatively, NEO4J_PASSWORDenvironment variable can be used. [default:null]--overwrite=<true/false>Optional: Overwrite the data in the target AuraDB Instance. [default:false] user@hostname:InformationTitleRunning database upload / push-to-cloud to load a database dump file to Neo4j AuraArticle Created Date3/15/2024, 10:57 PMURL Name360051366094-Running-push-to-cloud-to-load-a-database-dump-file-to-Neo4j-AuraLast Modified Date5/20/2024, 3:26 AM