一、基本语句
1.进入Neo4j的bin文件夹:D:\>cd D:\neo4j\neo4j-community-4.4.18\bin
2.建立服务:neo4j install-service
3.开启Neo4j:neo4j start /console
- start: (1)启动很快 (2)终端即使关闭后台也在运行 (3)要用neo4j stop才能关闭
- console:(1)启动很慢 (2)终端关闭则neo4j也关闭
4.关闭Neo4j:neo4j stop
5.Neo4j状态查询:neo4j status
C:\Windows\system32>D:
D:\>cd D:\neo4j\neo4j-community-4.4.18\bin
D:\neo4j\neo4j-community-4.4.18\bin>neo4j install-service
Neo4j service installed.
D:\neo4j\neo4j-community-4.4.18\bin>neo4j start
Directories in use:
home: D:\neo4j\neo4j-community-4.4.18
config: D:\neo4j\neo4j-community-4.4.18\conf
logs: D:\neo4j\neo4j-community-4.4.18\logs
plugins: D:\neo4j\neo4j-community-4.4.18\plugins
import: D:\neo4j\neo4j-community-4.4.18\import
data: D:\neo4j\neo4j-community-4.4.18\data
certificates: D:\neo4j\neo4j-community-4.4.18\certificates
licenses: D:\neo4j\neo4j-community-4.4.18\licenses
run: D:\neo4j\neo4j-community-4.4.18\run
Starting Neo4j.
Started neo4j. It is available at http://localhost:7474
There may be a short delay until the server is ready.
D:\neo4j\neo4j-community-4.4.18\bin>neo4j status
Neo4j is running
二、导入dump文件
- neo4j必须在关闭状态
- 创建新的数据库来导入
1.关闭neo4j并查看状态:neo4j stop /// neo4j status
- 若stop不能停止,则用 kill -s 9 强制关闭进程
D:\neo4j\neo4j-community-4.4.18\bin>neo4j stop
Stopping Neo4j........ stopped.
D:\neo4j\neo4j-community-4.4.18\bin>neo4j status
Neo4j is not running.
2.创建新数据库:要在配置文件中建立
- 先进入安装目录找到配置文件:D:\neo4j\neo4j-community-4.4.18\conf\neo4j.conf
- 定位行:#dbms.default_database=neo4j
- 在下面直接添加要创建的数据库:dbms.active_database=shield.db
- 注意数据库名字不能用下划线!
- 新建数据库在data文件夹下的database文件夹中
# The name of the default database
#dbms.default_database=neo4j
#dbms.default_database=my-test-database
dbms.active_database=shield.db
3.导入dump文件命令
- neo4j-admin load --from=<需要导入文件的地址> --database=<导入的数据库> --force
- --from:需要导入的数据文件路径
- --database:新的数据库名称(xx.db)
- --force :强制覆盖源数据库(此时是新建立的数据库 无影响)
D:\neo4j\neo4j-community-4.4.18\bin>
neo4j-admin load --from=D:\neo4j\neo4j-community-4.4.18\import\import-file.db.dump --database=shield.db --force
4.导入时版本升级报错
- 解决方法:在配置为文件中将 dbms.allow_upgrade=true 打开
D:\neo4j\neo4j-community-4.4.18\bin>neo4j-admin load --from=D:\neo4j\neo4j-community-4.4.18\import\shieldgraph.db.dump --database=shield.db --force
Selecting JVM - Version:11.0.14+8-LTS-263, Name:Java HotSpot(TM) 64-Bit Server VM, Vendor:Oracle Corporation
Done: 34 files, 281.5KiB processed.
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.
# Enable this to be able to upgrade a store from an older version.
dbms.allow_upgrade=true
5.导入后重启neo4j:neo4j start
D:\neo4j\neo4j-community-4.4.18\bin>neo4j start
Directories in use:
home: D:\neo4j\neo4j-community-4.4.18
config: D:\neo4j\neo4j-community-4.4.18\conf
logs: D:\neo4j\neo4j-community-4.4.18\logs
plugins: D:\neo4j\neo4j-community-4.4.18\plugins
import: D:\neo4j\neo4j-community-4.4.18\import
data: D:\neo4j\neo4j-community-4.4.18\data
certificates: D:\neo4j\neo4j-community-4.4.18\certificates
licenses: D:\neo4j\neo4j-community-4.4.18\licenses
run: D:\neo4j\neo4j-community-4.4.18\run
Starting Neo4j.
Started neo4j. It is available at http://localhost:7474
There may be a short delay until the server is ready.
6.打开 http://localhost:7474即可看到新导入的数据库及文件
三、导出dump文件
1.要先关闭数据库
2.导出dump文件命令
- neo4j-admin dump --database=<导出的数据库> --to=<需要导出文件的地址>
- --database:数据库名称(xx.db)
- --to:需要导入的数据文件路径与保存文件名称
D:\neo4j\neo4j-community-4.4.18\bin>neo4j-admin dump --database=ceshi.db --to=D:\neo4j\neo4j-community-4.4.18\dump\ceshi.db.dump
Selecting JVM - Version:11.0.14+8-LTS-263, Name:Java HotSpot(TM) 64-Bit Server VM, Vendor:Oracle Corporation
Done: 36 files, 968.5KiB processed文章来源:https://www.toymoban.com/news/detail-657450.html
文章来源地址https://www.toymoban.com/news/detail-657450.html
到了这里,关于Neo4j---(1)导入导出dump文件的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!