一. 數(shù)據(jù)導入
(1)import導入csv
格式:
neo4j-admin import [--mode=csv] [--database=<name>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--additional-config=<config-file-path>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--report-file=<filename>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--nodes[:Label1:Label2]=<"file1,file2,...">]
? ? ? ? ? ? ? ? ? ? ? ? ? [--relationships[:RELATIONSHIP_TYPE]=<"file1,file2,...">]
? ? ? ? ? ? ? ? ? ? ? ? ? [--id-type=<STRING|INTEGER|ACTUAL>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--input-encoding=<character-set>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--ignore-extra-columns[=<true|false>]]
? ? ? ? ? ? ? ? ? ? ? ? ? [--ignore-duplicate-nodes[=<true|false>]]
? ? ? ? ? ? ? ? ? ? ? ? ? [--ignore-missing-nodes[=<true|false>]]
? ? ? ? ? ? ? ? ? ? ? ? ? [--multiline-fields[=<true|false>]]
? ? ? ? ? ? ? ? ? ? ? ? ? [--delimiter=<delimiter-character>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--array-delimiter=<array-delimiter-character>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--quote=<quotation-character>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--max-memory=<max-memory-that-importer-can-use>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--f=<File containing all arguments to this import>]
? ? ? ? ? ? ? ? ? ? ? ? ? [--high-io=<true/false>]
命令:
./bin/neo4j-import --into data/databases/graph_kg_merge_id.db --nodes:Persons data/csv_kg_merge_id/persons.csv --nodes:Industry data/csv_kg_merge_id/industry.csv --relationships:Director data/csv_kg_merge_id/director.csv --multiline-fields=true
作者:ai_1046067944 來源:CSDN 原文:https://blog.csdn.net/ai_1046067944/article/details/85342494 版權聲明:本文為博主原創(chuàng)文章,轉載請附上博文鏈接届慈!
2. mount 多個數(shù)據(jù)庫database.db文件
(1)官網(wǎng)推薦方式:地址
If you have multiple graphs set up and want to quickly switch between each without modifying?dbms.active_database?in?conf/neo4j.conf, you can accomplish this with a?neo4j restartand with the environment variable?NEO4J_CONF?defined pointing to the appropriate/corresponding neo4j.conf file.
For example, one could define:
$NEO4J_HOME/conf
$NEO4J_HOME/conf_test
and where each directory has the same files, namely:
jmx.access? jmx.password? neo4j.conf? neo4j-wrapper.conf
and in the?$NEO4J_HOME/conf_tests/neo4j.conf?one might configure the databse name to a different graph:
# The name of the database to mount
dbms.active_database=graph.db.test
Then, prior to a restart of neo4j if one modifies the environment variable?NEO4J_CONF?to point to the $NEO4J_HOME/conf_test, for example:
export NEO4J_CONF="/home/neo/neo4j-enterprise-3.0.7/conf_test"
then upon restart of neo4j, it will then use the graph in the?graph.db.test?location.
Note: Be aware that the?dbms.active_database?setting in?neo4j.conf?is one of many settings that you may want/need to change. If for example you do not change?#dbms.directories.logs=logs?then both conf files will result in each Neo instance writing to?$NEO4J_HOME/logs.
(2)設置soft links 到 graph.db
因為Neo4j的import導入時,只能導入一個不存的db怨愤,這就在想創(chuàng)建多個庫時夭委,需要去切換杆麸,Neo4j默認的庫是graph.db旷赖,在./conf/neo4j.conf可以修改
切換多個庫的方法辅髓,將新庫重新連接到默認庫graph.db泣崩,然后重啟Neo4j
//軟連接
>>>cd ./data/databases/
>>>ln -s graph_kg.db graph.db
//重啟neo4j
>>>cd $NEO4j_HOME/bin
>>>./neo4j restart
// 刪除軟連接
>>>ln-s test_chk? test_chk_ln
>>>rm -rf? ./test_chk_ln
參考文章:地址