Upgrade to a higher version of Neo4j
Upgrading may be necessary when memory allocation to Neo4j is in need of review, in order to make sure that the Analytics service for example will not consume too much memory on the server. Please see here how to use neo4j-admin memrec and where to set the results.
Minor version Upgrade
A minor Neo4j version upgrade will not usually require a lot of maintenance - you will simply need to copy across the database files to the relevant location in the new Neo4j version and complete the standard configuration of the new service.
Major Version Upgrade (Migration in Neo4j terminology)
When upgrading to a major version, e.g, 3.5 to 4.x, be sure to read the information on the checklist and migration of a single instance (offline) provided by the Neo4j Migration - Upgrade and Migration Guide to get an idea of the required steps.
On the sites where anything other than IPV services with their configuration of Neo4j are using Neo4j, inspect “Breaking changes between Neo4j”, quoting the relevant version (for example, 3.5 and 4.x) - this is listed in the left-hand menu of the Neo4j Upgrade and Migration Guide, in case site-specific configuration is not supported anymore.
You will usually have to perform a multi-step operation, which can include:
- a change in the JDK version
- making a proper dump of the database in the old version of Neo4j, and a restore in the new version
- changing a setting in the new version which will allow Neo4j to recognize and convert the old version of the graph database from a backup
- monitoring the log file after the Neo4j start
These steps may be necessary in order to make sure the conversion is completed successfully.
The conversion takes time, so Neo4j suggests that you take a backup as shown below and perform a test upgrade to better estimate the amount of offline time that may be required on a Production system.
Basic steps
- Install the version you require, e.g. C:\Program Files\neo4j-community-4.3.5; C:\Program Files\neo4j-community-4.4.3; etc.
- Stop the old Neo4j service or console instance.
- Back up the database properly into a dump file using the old installation of Neo4j (for details see Tutorial: Back up and copy a database in a standalone instance).
- In Command Prompt, navigate to the installation directory within the old installation
- Execute bin\neo4j stop -Verbose
- Execute bin\neo4j-admin dump --to=[fullpath to dump file]. for more details, see Back up an offline database - Operations Manual
- If you only give a directory in the fullpath then the dump process will automatically create a file within it called graph.db.dump
- If you are upgrading Neo4j on the same server, deregister the old neo4j service: bin\neo4j cd\uninstall-service
- Install and verify that you have the required version of JDK for the new Neo4j.
- Install neo4j as a service: bin\neo4j install-service
- Load and migrate the backed up database:
- Set (uncomment) dbms.allow_upgrade=true in the [new Neo4j installation path]\conf\neo4j.conf file.
- For Neo4j supporting Metadata Central, disable the authentication by uncommenting the line: dbms.security.auth_enabled=false in the [Neo4j installation path]\conf\neo4j.conf file.
- In command prompt, navigate to the installation directory within the new installation.
- Restore the database referring to the generated dump file:
bin\neo4j-admin load --from=[fullpath to dump file] --database=neo4j --force
the default name of the database from 4.3 onwards is neo4j. See Restore a database dump - Operations Manual. The command should return something similar to:
“The loaded database is not on the latest format (current:v0.A.9, latest:SF4.3.0). Set dbms.allow_upgrade=true to enable migration.”
- Migrate the database to the new structure
- Start the neo4j bin\neo4j start
- Monitor the logs/neo4j.log file for information on how the migration is progressing. You should see “Starting upgrade of database” “Migrating Store files (1/11):” ….. and finally “Successfully finished upgrade of database, took XXs XXXms"
- Once the migration has completed, stop the neo4j: bin\neo4j stop
- Comment out the #dbms.allow_upgrade=false in the neo4j.conf file.
- Apply any remaining IPV service-specific configuration for the new installation.
- NOTE: The newer Neo4j installation may require you to change the authentication password. If so, this new password must be used instead of the default password which is automatically provided within the IPV Analytics Service installer program.
- Start the Neo4j service
- bin/neo4j start