官方入門例子:neo4j-graph-examples/get-started: An introduction to graph databases and Neo4j for new users
官方例子倉庫:https://github.com/neo4j-graph-examples?
下載數據
git clone https://github.com/neo4j-graph-examples/get-started
下載后,看下data目錄的數據,都是zip包:
ls data/
empty-44.dump ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? northwind-subset-data-only.zip
empty-50.dump ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? northwind-subset-node-and-relationship-mapping.zip
northwind-data-importer-data.zip ? ? ? ? ? ? ? ? ? ? ? ?northwind-subset-node-only-mapping.zip
northwind-data-importer-model-data.zip ? ? ? ? ? ? ? ? ?northwind-subset-shipper-mapping.zip
northwind-full.zip ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?people_locations_full.zip
northwind-subset-data-only-no-model.zip ? ? ? ? ? ? ? ? people_locations_nodes_only.zip?
目錄里有server.py 文件,可以python3.11 server.py啟動,然后就可以通過瀏覽8000端口來看項目文件:
Directory listing for / Directory listing for /__________________________________________________________________________________________________________* .git/* .gitignore* .vscode/* data/* documentation/* README.adoc* relate.project-install.json* server.py__________________________________________________________________________________________________________
導入數據
Data Import
-
Create empty AuraDB instance
-
Download the?zip file?to your computer.
-
Open Import in Neo4j Workspace (or Data Importer)
-
Use "Open Model with data" from the "…?" menu to load the zip
-
Explore the model, preview the import
-
Run Import
先啟動neo4j服務:
啟動FreeBSD VirtualBox虛擬機 192.168.0.109
登錄普通賬戶,然后
sudo neo4j console 啟動服務
在瀏覽器中打開neo4j的管理界面:
http://192.168.0.109:7474/
但是,沒找到導入數據庫的地方。
使用neo4j-admin 導入
安裝好neo4j后,就有neo4j-admin工具可以使用?
導入數據
sudo neo4j-admin load --from data/empty-44.dump --database "database"
導入成功,提示:
sudo neo4j-admin load --from data/empty-44.dump --database "database"
Selecting JVM - Version:11.0.26+4-1, Name:OpenJDK 64-Bit Server VM, Vendor:OpenJDK BSD Porting Team
Done: 68 files, 852.2KiB processed.
?導入成功后,后面應該怎么辦呢?
在頁面里沒有看到新的數據庫啊?
待續
以后再補上。
調試
登錄neo4j的控制臺:http://192.168.0.109:7474/browser/ 我沒找到導入數據庫的地方
?使用neo4j-admin 導入
導入時提示:NEO4J_CONF path doesn't exist or not a directory: /usr/local/neo4j/conf
sudo neo4j-admin load --from data/empty-44.dump ?--database "database"
Selecting JVM - Version:11.0.26+4-1, Name:OpenJDK 64-Bit Server VM, Vendor:OpenJDK BSD Porting Team
NEO4J_CONF path doesn't exist or not a directory: /usr/local/neo4j/conf
創建了這個目錄,然后再執行就ok了
sudo mkdir -p /usr/local/neo4j/conf
sudo neo4j-admin load --from data/empty-44.dump --database "database"
Selecting JVM - Version:11.0.26+4-1, Name:OpenJDK 64-Bit Server VM, Vendor:OpenJDK BSD Porting Team
Done: 68 files, 852.2KiB processed.