neo4j使用export导出然后进行恢复(graphml格式)
1.备份
备份所有数据为 GraphML 格式
在安装了neo4j客户端的机器上进行操作
CALL apoc.export.graphml.all('neo4j_backup_20250711.graphml', {useTypes:true});
CALL apoc.export.graphml.all 用于将数据库中所有数据导出为 neo4j_backup.graphml。
useTypes:true 表示在导出时保留类型信息
2.模拟删除所有数据
删除标签数据
MATCH (n) DETACH DELETE n;
若标签上创建了索引和约束,可以不用删除掉,若删除掉的话,导入后需要重新创建
3.导入
//恢复 GraphML 文件
CALL apoc.import.graphml('neo4j_backup_20250711.graphml', {batchSize:1000, readLabels:true});
说明:导入不会创建索引和约束
浙公网安备 33010602011771号