简体   繁体   中英

How do I load a neo4j backup into my new instance of neo4j on Azure?

I have a graph.db file which contains all the data from my local Neo4j where I have built my database.

I have created a Neo4j HA Cluster on Azure.

How do I get the graph.db from my local machine to the Azure version of Neo4j?

You can transfer the files via SCP

As long as you have SSH access to your Azure instance, you can copy files to it using the command scp (or any one of the number of utilities for Windows for using SCP). Just plug in the same address / credentials as you would use for SSH, and then use the command / application to send the entire graph.db directory over; if you prefer, you can tar it beforehand so only one file is sent, but then make sure to untar it once it is uploaded.

Next, make sure that the version of Neo4J that created the graph.db is the same version as the Neo4J that you are copying to. You can find the version number under the "Database" section of the first tab on the top of the control strip on the left of the web UI.

Web UI版本

Only the version number matters for this, not the "Edition"; eg v3.3.3 Community is functionally equivalent to v3.3.3 Enterprise for your purposes.

Same version number

If the version of the local Neo4J and the destination Neo4J is the same, once graph.db is uploaded, it can directly replace any existing graph.db on the destination Neo4J. SSH into your box, make sure Neo4J is off, and then move the graph.db folder to the /data directory of Neo4J. Turn Neo4J back on. It should then have your locally-created database.

Different version number

If the version number is not the same, that's okay as long as the local Neo4J is an older version. There will be a small amount of additional work. Once you have copied the graph.db to the destination server, SSH in to it and make sure Neo4J is not running. Next, to import the database, run:

neo4j-admin import --mode=database --database=graph.db --from=/path/to/graph.db

Then, in the config of the instance, be sure to set dbms.allow_format_migration=true and dbms.allow_upgrade=true to allow it to upgrade the database file.

Turn Neo4J on. It may take awhile during the startup, but that is only because it is upgrading your database. After the first startup, it should start much faster. Once it is started, it should then have your locally-created database.

Afterwards, be sure to edit the config file and set dbms.allow_format_migration=false and dbms.allow_upgrade=false (or else remove them entirely; they default to false) in order to disallow future unintentional upgrading.

More info is available at the official Neo4J Upgrade Guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM