摘要:最近在研究圖計算相關技術,前一階段學了的知識,在學習的過程也對比一些其它的開源圖數(shù)據(jù)庫,如,還有一些通用框架。在的對比學習過程中,希望首先把已有的數(shù)據(jù)導入到新的數(shù)據(jù)庫中,還好官方提供了數(shù)據(jù)導入工具。
最近在研究圖計算相關技術,前一階段學了Neo4j的知識,在學習的過程也對比一些其它的開源圖數(shù)據(jù)庫,如OrientDB,還有一些通用框架TinkerPop。
在OrientDB的對比學習過程中,希望首先把已有的數(shù)據(jù)導入到新的數(shù)據(jù)庫中,還好OrientDB官方提供了Neo4j數(shù)據(jù)導入工具orientdb-neo4j-importer。然而一切皆有坑...
按照官方文檔進行數(shù)據(jù)導入,執(zhí)行命令:
sh orientdb-neo4j-importer-2.2.31/bin/orientdb-neo4j-importer.sh -neo4jdbdir ../graph.db/ -neo4jlibdir ../neo4jlib/
出現(xiàn)以下報錯:
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文件夾下,再次執(zhí)行還是同樣的報錯。
查看源代碼也沒發(fā)現(xiàn)此處有問題,再通過sh打印詳細信息發(fā)現(xiàn)環(huán)境變量ORIENTDB_HOME設置有問題,執(zhí)行以下命令定義環(huán)境變量:
export ORIENTDB_HOME=/root/orientdb-community-importers-2.2.31
再次執(zhí)行命令,順利通過!
[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數(shù)據(jù)庫,并沒有看到新導入的數(shù)據(jù)庫... 再仔細查看發(fā)現(xiàn)沒有添加選項-odbdir(但是默認值應該是DB_HOME/databases/neo4j_import,不知道為何沒有生效...),數(shù)據(jù)庫導入到其它路徑下,拷貝過來后可以正常使用了。
(如圖,neo4j_import數(shù)據(jù)庫)
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/17690.html
摘要:資源描述框架三元組存儲為了解決問題,把我們的所有文檔從遷移到資源描述框架,這一框架又被稱為三元組存儲。下面這些資源描述框架的三元組可以體現(xiàn)這一示意圖我們的數(shù)據(jù)庫確實很給力,總體來說我們也相當滿意。 【編者按】你會怎么選擇數(shù)據(jù)庫,是關系數(shù)據(jù)庫、XML 數(shù)據(jù)庫、資源描述框架(RDF),還是圖形數(shù)據(jù)庫?這篇演講深入而生動地探討了各種選擇。本文系國內(nèi) ITOM 管理平臺 OneAPM 編譯呈現(xiàn)...
閱讀 1387·2021-11-25 09:43
閱讀 3608·2021-11-10 11:48
閱讀 5190·2021-09-23 11:21
閱讀 1613·2019-08-30 15:55
閱讀 3523·2019-08-30 13:53
閱讀 1251·2019-08-30 10:51
閱讀 883·2019-08-29 14:20
閱讀 1989·2019-08-29 13:11