Neo4j - 数据库备份和恢复

neo4j-admin 工具支持在线/离线备份,在线备份需要收费。本章主要介绍离线版

备份

1、在对Neo4j数据进行备份、还原、迁移的操作时,首先要关闭neo4j

./bin/neo4j stop

2、数据备份到文件

./bin/neo4j-admin dump --database=graph.db --to=/root/soul_20221003.dump

还原

1、还原、迁移之前 ,关闭neo4j服务。操作同上

./bin/neo4j-admin load --from=/root/soul_20221003.dump --database=graph.db

2、重启服务

./bin/neo4j start

如果启动后没有数据,检查配置项:

将dbms.allow_upgrade设为true

2022-10-03 03:12:25.709+0000 INFO  Starting...
2022-10-03 03:12:26.867+0000 INFO  This instance is ServerId{7b5227aa} (7b5227aa-aadf-4c99-8ee1-3720204ff61f)
2022-10-03 03:12:29.991+0000 INFO  ======== Neo4j 4.4.11 ========
2022-10-03 03:12:33.142+0000 INFO  Performing postInitialization step for component 'security-users' with version 3 and status CURRENT
2022-10-03 03:12:33.143+0000 INFO  Updating the initial password in component 'security-users'
2022-10-03 03:12:33.201+0000 ERROR [soul/44aadfa1] Error upgrading database. Database left intact and will likely not be able to start: org.neo4j.storageengine.migration.UpgradeNotAllowedException: Neo4j cannot be started because the database files require upgrading and upgrades are disabled in the configuration. Please set 'dbms.allow_upgrade' to 'true' in your configuration file and try again. Detailed description: Upgrade is required to migrate store to new major version.
2022-10-03 03:12:33.298+0000 INFO  Bolt enabled on [0:0:0:0:0:0:0:0%0]:7687.
2022-10-03 03:12:35.200+0000 INFO  Remote interface available at http://localhost:7474/


 

你可能感兴趣的:(环境搭建,neo4j,数据库)