一. 数据导入
(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 版权声明:本文为博主原创文章,转载请附上博文链接!
2. mount 多个数据库database.db文件
(1)官网推荐方式:地址
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,这就在想创建多个库时,需要去切换,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
参考文章:地址
网友评论