摘要:最近在研究图计算相关技术,前一阶段学了的知识,在学习的过程也对比一些其它的开源图数据库,如,还有一些通用框架。在的对比学习过程中,希望首先把已有的数据导入到新的数据库中,还好官方提供了数据导入工具。
最近在研究图计算相关技术,前一阶段学了Neo4j的知识,在学习的过程也对比一些其它的开源图数据库,如OrientDB,还有一些通用框架TinkerPop。
在OrientDB的对比学习过程中,希望首先把已有的数据导入到新的数据库中,还好OrientDB官方提供了Neo4j数据导入工具orientdb-neo4j-importer。然而一切皆有坑...
按照官方文档进行数据导入,执行命令:
sh orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh -neo4jdbdir ../graph.db/ -neo4jlibdir ../neo4jlib/
出现以下报错:
Exception in thread "main" java.lang.NoClassDefFoundError: com/orientechnologies/orient/core/OConstants at com.orientechnologies.orient.neo4jimporter.ONeo4jImporterMain.main(ONeo4jImporterMain.java:15) Caused by: java.lang.ClassNotFoundException: com.orientechnologies.orient.core.OConstants at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 1 more
尝试把importer/lib/orientdb-neo4j-importer-2.2.31.jar拷贝到orientdb安装目录的lib文件夹下,再次执行还是同样的报错。
查看源代码也没发现此处有问题,再通过sh打印详细信息发现环境变量ORIENTDB_HOME设置有问题,执行以下命令定义环境变量:
export ORIENTDB_HOME=/root/orientdb-community-importers-2.2.31
再次执行命令,顺利通过!
[root@datanode orientdb-community-importers-2.2.31]# sh -x orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh -neo4jdbdir ../graph.db/ -neo4jlibdir ../neo4jlib/ + PRG=orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh + "[" -h orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh "]" ++ dirname orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh + PRGDIR=orientdb-neo4j-importer-2.2.31/bin + "[" -f /root/orientdb-community-importers-2.2.31/lib/orientdb-neo4j-importer-2.2.31.jar "]" + export ORIENTDB_HOME + "[" -f /usr/java/jdk1.8.0_91/bin/java "]" + JAVA=/usr/java/jdk1.8.0_91/bin/java + export JAVA + LOG_FILE=/root/orientdb-community-importers-2.2.31/config/orientdb-neo4j-importer-log.properties + JAVA_MAX_DIRECT=-XX:MaxDirectMemorySize=512g + JAVA_OPTS_SCRIPT="-XX:MaxDirectMemorySize=512g -Djava.util.logging.config.file=/root/orientdb-community-importers-2.2.31/config/orientdb-neo4j-importer-log.properties" + ARGS= + for var in ""$@"" + ARGS=" -neo4jdbdir" + for var in ""$@"" + ARGS=" -neo4jdbdir ../graph.db/" + for var in ""$@"" + ARGS=" -neo4jdbdir ../graph.db/ -neo4jlibdir" + for var in ""$@"" + ARGS=" -neo4jdbdir ../graph.db/ -neo4jlibdir ../neo4jlib/" + [[ 4 -gt 1 ]] + key=-neo4jdbdir + case $key in + shift + [[ 3 -gt 1 ]] + key=../graph.db/ + case $key in + shift + [[ 2 -gt 1 ]] + key=-neo4jlibdir + case $key in + NEO4JLIB=../neo4jlib/ + shift + shift + [[ 0 -gt 1 ]] + exec /usr/java/jdk1.8.0_91/bin/java -client -cp "../neo4jlib//*:/root/orientdb-community-importers-2.2.31/lib/*" -XX:MaxDirectMemorySize=512g -Djava.util.logging.config.file=/root/orientdb-community-importers-2.2.31/config/orientdb-neo4j-importer-log.properties com.orientechnologies.orient.neo4jimporter.ONeo4jImporterMain -neo4jdbdir ../graph.db/ -neo4jlibdir ../neo4jlib/ Neo4j to OrientDB Importer v.2.2.31 (build 285537d2767275f460df32c6a3be01bfff6a517c, branch 2.2.x) - Copyrights (c) 2016 OrientDB LTD WARNING: "o" option not found. Defaulting to "false". WARNING: "i" option not found. Defaulting to "false". WARNING: "odbdir" option not found. Defaulting to "/root/databases/neo4j_import". Please make sure that there are no running servers on: "../graph.db" (Neo4j) and: "/root/databases/neo4j_import" (OrientDB) Initializing Neo4j...Done Initializing OrientDB...Done Importing Neo4j database: "../graph.db" into OrientDB database: "/root/databases/neo4j_import" Getting all Nodes from Neo4j and creating corresponding Vertices in OrientDB... 4 OrientDB Vertices have been created (100% done) Done Creating internal Indices on properties "Neo4jNodeID" & "Neo4jLabelList" on all OrientDB Vertices Classes... 4 OrientDB Indices have been created (100% done) Done Getting all Relationships from Neo4j and creating corresponding Edges in OrientDB... 2 OrientDB Edges have been created (100% done) Done Getting Constraints from Neo4j and creating corresponding ones in OrientDB... 0 OrientDB UNIQUE Indices have been created Done Getting Indices from Neo4j and creating corresponding ones in OrientDB... 0 OrientDB Indices have been created Done Import completed! Shutting down OrientDB...Done Shutting down Neo4j...Done =============== Import Summary: =============== - Found Neo4j Nodes : 4 -- With at least one Label : 4 --- With multiple Labels : 0 -- Without Labels : 0 - Imported OrientDB Vertices : 4 (100%) - Found Neo4j Relationships : 2 - Imported OrientDB Edges : 2 (100%) - Found Neo4j Constraints : 0 - Imported OrientDB Constraints (UNIQUE Indices created) : 0 - NOT UNIQUE Indices created due to failure in creating UNIQUE Indices : 0 - Found Neo4j (non-constraint) Indices : 0 - Imported OrientDB Indices : 0 - Additional internal Indices created : 4 - Total Import time: : 6 seconds -- Initialization time : 5 seconds -- Time to Import Nodes : 0 seconds (35.4 nodes/sec) -- Time to Import Relationships : 0 seconds (22.47 rels/sec) -- Time to Import Constraints and Indices : 0 seconds (0 indices/sec) -- Time to Create Internal Indices (on vertex properties "Neo4jNodeID" & "Neo4jLabelList") : 1 seconds (7.01 indices/sec)
以为一切搞定,启动OrientDB数据库,并没有看到新导入的数据库... 再仔细查看发现没有添加选项-odbdir(但是默认值应该是DB_HOME/databases/neo4j_import,不知道为何没有生效...),数据库导入到其它路径下,拷贝过来后可以正常使用了。
(如图,neo4j_import数据库)
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/17690.html
摘要:资源描述框架三元组存储为了解决问题,把我们的所有文档从迁移到资源描述框架,这一框架又被称为三元组存储。下面这些资源描述框架的三元组可以体现这一示意图我们的数据库确实很给力,总体来说我们也相当满意。 【编者按】你会怎么选择数据库,是关系数据库、XML 数据库、资源描述框架(RDF),还是图形数据库?这篇演讲深入而生动地探讨了各种选择。本文系国内 ITOM 管理平台 OneAPM 编译呈现...
阅读 1366·2021-11-25 09:43
阅读 3578·2021-11-10 11:48
阅读 5078·2021-09-23 11:21
阅读 1595·2019-08-30 15:55
阅读 3506·2019-08-30 13:53
阅读 1229·2019-08-30 10:51
阅读 864·2019-08-29 14:20
阅读 1969·2019-08-29 13:11