{"id":316966,"date":"2021-02-04T11:05:07","date_gmt":"2021-02-04T03:05:07","guid":{"rendered":"http:\/\/4563.org\/?p=316966"},"modified":"2021-02-04T11:05:07","modified_gmt":"2021-02-04T03:05:07","slug":"neo4j-%e5%af%bc%e5%85%a5-nebula-graph-%e7%9a%84%e5%ae%9e%e8%b7%b5%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=316966","title":{"rendered":"Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u603b\u7ed3"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u603b\u7ed3               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NebulaGraph <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6458\u8981\uff1a \u4e3b\u8981\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7\u5b98\u65b9 ETL \u5de5\u5177 Exchange \u5c06\u4e1a\u52a1\u7ebf\u4e0a\u6570\u636e\u4ece Neo4j \u76f4\u63a5\u5bfc\u5165\u5230 Nebula Graph \u4ee5\u53ca\u5728\u5bfc\u5165\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u95ee\u9898\u548c\u4f18\u5316\u65b9\u6cd5\u3002<\/p>\n<blockquote>\n<p>\u672c\u6587\u9996\u53d1\u4e8e Nebula \u8bba\u575b\uff1ahttps:\/\/discuss.nebula-graph.com.cn\/t\/topic\/2044<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210205_601d102178108.png\" alt=\"Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u603b\u7ed3\" \/><\/p>\n<h2>1 \u80cc\u666f<\/h2>\n<p>\u968f\u7740\u4e1a\u52a1\u6570\u636e\u91cf\u4e0d\u65ad\u589e\u957f\uff0c\u4e1a\u52a1\u5bf9\u56fe\u6570\u636e\u5e93\u5728\u7ebf\u6570\u636e\u5b9e\u65f6\u66f4\u65b0\u5199\u5165\u548c\u67e5\u8be2\u7684\u6548\u7387\u8981\u6c42\u4e5f\u4e0d\u65ad\u589e\u52a0\u3002Neo4j \u5b58\u5728\u660e\u663e\u6027\u80fd\u4e0d\u8db3\uff0cNeo4j \u793e\u533a\u5f00\u6e90\u7248\u672c\u53ea\u652f\u6301\u5355\u673a\u90e8\u7f72\uff0c\u6269\u5c55\u80fd\u529b\u5b58\u5728\u6bd4\u8f83\u5927\u7684\u95ee\u9898\uff0c\u65e0\u6cd5\u6ee1\u8db3\u8bfb\u5199\u6027\u80fd\u7684\u7ebf\u6027\u6269\u5c55\u4ee5\u53ca\u8bfb\u5199\u5206\u79bb\u7684\u4e1a\u52a1\u9700\u6c42\uff0c\u5e76\u4e14\u5f00\u6e90\u7248\u672c Neo4j \u5bf9\u70b9\u548c\u8fb9\u7684\u603b\u6570\u636e\u91cf\u4e5f\u6709\u9650\u5236\uff1b\u800c Neo4j \u4f01\u4e1a\u7248\u56e0\u679c\u96c6\u7fa4\u4e5f\u5b58\u5728\u5355\u673a\u4e3b\u8282\u70b9 Cypher \u5b9e\u65f6\u5199\u5165\u7684\u6027\u80fd\u74f6\u9888\u3002<\/p>\n<p>\u76f8\u6bd4\u4e8e Neo4j\uff0cNebula Graph \u6700\u5927\u7684\u7279\u8272\u4fbf\u662f\u91c7\u7528 shared-nothing \u5206\u5e03\u5f0f\u7684\u67b6\u6784\uff0c\u65e0\u5355\u4e3b\u5199\u5165\u74f6\u9888\u95ee\u9898\uff0c\u8bfb\u5199\u652f\u6301\u7ebf\u6027\u6269\u5c55\uff0c\u64c5\u957f\u5904\u7406\u5343\u4ebf\u8282\u70b9\u3001\u4e07\u4ebf\u6761\u8fb9\u7684\u8d85\u5927\u89c4\u6a21\u6570\u636e\u96c6\u3002<\/p>\n<p>\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7\u5b98\u65b9 ETL \u5de5\u5177 Exchange \u5c06\u4e1a\u52a1\u7ebf\u4e0a\u6570\u636e\u4ece Neo4j \u76f4\u63a5\u5bfc\u5165\u5230 Nebula Graph \u4ee5\u53ca\u5728\u5bfc\u5165\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u95ee\u9898\u548c\u4f18\u5316\u65b9\u6cd5\u3002\u5176\u4e2d\u7edd\u5927\u90e8\u5206\u95ee\u9898\u90fd\u5df2\u7ecf\u901a\u8fc7\u8bba\u575b\u53d1\u5e16\u7684\u65b9\u5f0f\u5f97\u5230\u793e\u533a\u7684\u652f\u6301\u548c\u89e3\u51b3\uff0c\u672c\u6587\u4f1a\u7ed3\u5408\u95ee\u9898\u8fdb\u884c\u9010\u4e00\u5217\u4e3e\u3002<\/p>\n<h2>2 \u90e8\u7f72\u73af\u5883<\/h2>\n<p>\u7cfb\u7edf\u73af\u5883\uff1a<\/p>\n<ul>\n<li>CPU name\uff1aIntel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz<\/li>\n<li>CPU Cores\uff1a40<\/li>\n<li>Memory Size\uff1a376 GB<\/li>\n<li>Disk\uff1aHDD<\/li>\n<li>System\uff1aCentOS Linux release 7.4.1708 (Core)<\/li>\n<\/ul>\n<p>\u8f6f\u4ef6\u73af\u5883\uff1a<\/p>\n<ul>\n<li>Neo4j\uff1a3.4 \u7248\u672c\uff0c\u4e94\u8282\u70b9\u56e0\u679c\u96c6\u7fa4<\/li>\n<li> Nebula Graph\uff1a\n<ul>\n<li>\u7248\u672c\uff1a nebula-graph v1.1.0 \u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\uff0c<\/li>\n<li>\u90e8\u7f72\uff1a\u5355\u53f0\u670d\u52a1\u5668\u90e8\u7f72\u4e09\u8282\u70b9 Nebula Graph \u96c6\u7fa4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>Exchange\uff1anebula-java v1.1.0 \u6e90\u7801\u7f16\u8bd1 jar \u5305<\/li>\n<li> \u6570\u4ed3\u73af\u5883\uff1a\n<ul>\n<li>hadoop-2.7.4<\/li>\n<li>spark-2.3.1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u6ce8\u610f\uff1a\u5355\u53f0\u673a\u5668\u90e8\u7f72 Nebula \u591a\u8282\u70b9\u7684\u7aef\u53e3\u5206\u914d\uff1a\u6bcf\u4e2a storage \u8fd8\u4f1a\u5c06\u7528\u6237\u914d\u7f6e\u7684\u7aef\u53e3\u53f7 + 1 \u7684\u7aef\u53e3\u4f5c\u4e3a\u5185\u90e8\u4f7f\u7528\u3002\u8bf7\u53c2\u8003\u8bba\u575b\u5e16\u5b50 nebula \u4ece neo4j \u5bfc\u5165\u6570\u636e\u51fa\u73b0 Get UUID Failed \u9519\u8bef<\/p>\n<h2>3 \u5168\u91cf &amp; \u589e\u91cf\u6570\u636e\u5bfc\u5165<\/h2>\n<h3>3.1 \u5168\u91cf\u5bfc\u5165<\/h3>\n<p>\u6839\u636e Neo4j \u70b9\u548c\u8fb9\u7684\u5c5e\u6027\u4fe1\u606f\u521b\u5efa Nebula Graph \u7684 Tag \u548c Edge \u7ed3\u6784\uff0c\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u4e00\u70b9\uff0c\u4e1a\u52a1\u53ef\u80fd\u4f1a\u6839\u636e\u4e0d\u540c\u9700\u6c42\u53ea\u5728\u90e8\u5206\u70b9\u548c\u8fb9\u4e0a\u589e\u52a0 Neo4j \u70b9\u548c\u8fb9\u7684\u5c5e\u6027\u4fe1\u606f\uff0c\u5176\u4ed6\u70b9\u548c\u8fb9\u5bf9\u5e94\u7684\u5c5e\u6027\u4e3a <code>NULL<\/code>\uff0c\u6240\u4ee5\u9700\u8981\u5148\u8ddf\u4e1a\u52a1\u660e\u786e\u4e00\u4e0b\u70b9\u548c\u8fb9\u7684\u5168\u90e8\u5c5e\u6027\u4fe1\u606f\uff0c\u907f\u514d\u9057\u6f0f\u5c5e\u6027\u3002Nebula Graph \u7684 Schema \u4fe1\u606f\u7c7b\u4f3c MySQL\uff0c\u652f\u6301 Create \u548c Alter \u6dfb\u52a0\u5c5e\u6027\uff0c\u5e76\u4e14\u6240\u6709\u7684 Tag \u548c Edge \u7684\u5143\u6570\u636e\u4fe1\u606f\u662f\u4e00\u81f4\u7684\u3002<\/p>\n<p>1 \u3001Nebula Graph \u521b\u5efa Tag \u548c Edge<\/p>\n<pre><code># \u793a\u4f8b # \u521b\u5efa\u56fe\u7a7a\u95f4\uff0c10 \u4e2a\u5206\u533a\uff0c3 \u4e2a storage \u526f\u672c\u3002 CREATE SPACE test(partition_num=10,replica_factor=3); # \u9009\u62e9\u56fe\u7a7a\u95f4 test USE test; # \u521b\u5efa\u6807\u7b7e tagA CREATE TAG tagA(vid string, field-a0 string, field-a1 bool, field-a2 double); # \u521b\u5efa\u6807\u7b7e tagB CREATE TAG tagB(vid string, field-b0 string, field-b1 bool, field-b2 double); # \u521b\u5efa\u8fb9\u7c7b\u578b edgeAB CREATE EDGE edgeAB(vid string, field-e0 string, field-e1 bool, field-e2 double); <\/code><\/pre>\n<p>2 \u3001Exchange \u5bfc\u5165\u914d\u7f6e\u6587\u4ef6<\/p>\n<ul>\n<li>Exchange \u914d\u7f6e\u76ee\u524d\u4e0d\u652f\u6301 <code>bolt+routing<\/code> \u7684\u65b9\u5f0f\u8fde\u63a5 neo4j\uff0c\u5982\u679c\u662f\u56e0\u679c\u96c6\u7fa4\uff0c\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u4ece\u8282\u70b9\u8fdb\u884c <code>bolt<\/code> \u65b9\u5f0f\u76f4\u8fde\u8bfb\u53d6\u6570\u636e\uff0c\u51cf\u5c11\u96c6\u7fa4\u538b\u529b\u3002<\/li>\n<li>\u6211\u4eec\u4e1a\u52a1\u7684 Neo4j \u6570\u636e\u70b9\u548c\u8fb9\u7684 vid \u662f string \u7c7b\u578b\uff0cNebula v1.x \u7248\u672c\u8fd8\u4e0d\u652f\u6301 string \u76f4\u63a5\u5f53\u505a vid \uff08 v2.0 \u652f\u6301\uff09\uff0c\u8003\u8651\u5230\u5b98\u65b9\u6587\u6863\u4e2d\u7684\u63cf\u8ff0\uff1a\u201c\u5f53\u70b9\u6570\u91cf\u5230\u8fbe\u5341\u4ebf\u7ea7\u522b\u65f6\uff0c\u7528 hash \u51fd\u6570\u751f\u6210 vid \u6709\u4e00\u5b9a\u7684\u51b2\u7a81\u6982\u7387\u3002\u56e0\u6b64 Nebula Graph \u63d0\u4f9b UUID \u51fd\u6570\u6765\u907f\u514d\u5927\u91cf\u70b9\u65f6\u7684 vid \u51b2\u7a81\u3002\u201d \u9009\u62e9\u4e86 uuid() \u4f5c\u4e3a\u8f6c\u5316\u51fd\u6570\uff0c\u4f46\u662f\u5bfc\u5165\u6548\u7387\u8981\u6bd4 hash \u4f4e\uff0c\u800c\u4e14 uuid() \u5728\u672a\u6765\u7248\u672c\u53ef\u80fd\u5b58\u5728\u517c\u5bb9\u95ee\u9898\u3002<\/li>\n<li>partition: \u662f\u6307 Exchange \u4ece Neo4j \u62c9\u53d6\u6570\u636e\u7684\u5206\u9875\u4e2a\u6570\u3002<\/li>\n<li>batch: \u662f\u6307\u6279\u91cf\u63d2\u5165 Nebula \u7684 batch \u5927\u5c0f\u3002<\/li>\n<\/ul>\n<pre><code>{   # Spark relation config   spark: {     app: {       name: Spark Writer     }      driver: {       cores: 1       maxResultSize: 1G     }      cores {       max: 16     }   }    # Nebula Graph relation config   nebula: {     address:{       graph:[\"xxx.xxx.xxx.xx:3699\"]       meta:[\"xxx.xxx.xxx.xx:45500\"]     }     user: user     pswd: password     space: test      connection {       timeout: 3000       retry: 3     }      execution {       retry: 3     }      error: {       max: 32       output: \/tmp\/errors     }      rate: {       limit: 1024       timeout: 1000     }   }      # Processing tags   tags: [     # Loading tag from neo4j     {       name: tagA       type: {         source: neo4j         sink: client       }       server: \"bolt:\/\/xxx.xxx.xxx.xxx:7687\"       user: neo4j       password: neo4j       exec: \"match (n:tagA) where id(n) &lt; 300000000 return n.vid as vid, n.field-a0 as field-a0, n.field-a1 as field-a1, n.field-a2 as field-a2 order by id(n)\"       fields: [vid, field-a0, field-a1, field-a2]       nebula.fields: [vid, field-a0, field-a1, field-a2]       vertex: {         field: vid         policy: \"uuid\"       }       partition: 10       batch: 1000       check_point_path: \/tmp\/test     }     # Loading tag from neo4j     {       name: tagB       type: {         source: neo4j         sink: client       }       server: \"bolt:\/\/xxx.xxx.xxx.xxx:7687\"       user: neo4j       password: neo4j       exec: \"match (n:tagB) where id(n) &lt; 300000000 return n.vid as vid, n.field-b0 as field-b0, n.field-b1 as field-b1, n.field-b2 as field-b2 order by id(n)\"       fields: [vid, field-b0, field-b1, field-b2]       nebula.fields: [vid, field-b0, field-b1, field-b2]       vertex: {         field: vid         policy: \"uuid\"       }       partition: 10       batch: 1000       check_point_path: \/tmp\/test     }   ]    # Processing edges   edges: [    # Loading edges from neo4j     {       name: edgeAB       type: {         source: neo4j         sink: client       }       server: \"bolt:\/\/xxx.xxx.xxx.xxx:7687\"       user: neo4j       password: neo4j       exec: \"match (a:tagA)-[r:edgeAB]-&gt;(b:tagB) where id(r) &lt; 300000000 return n.vid as vid, n.field-e0 as field-e0, n.field-e1 as field-e1, n.field-e2 as field-e2 order by id(r)\"       fields: [vid, field-e0, field-e1, field-e2]       nebula.fields: [vid, field-e0, field-e1, field-e2]       source: {         field: a.vid         policy: \"uuid\"       }       target: {         field: b.vid         policy: \"uuid\"       }       partition: 10       batch: 1000       check_point_path: \/tmp\/test     }   ] } <\/code><\/pre>\n<p>3 \u3001\u6267\u884c\u5bfc\u5165\u547d\u4ee4<\/p>\n<pre><code>nohup spark-submit --class com.vesoft.nebula.tools.importer.Exchange --master \"local\" exchange-1.1.0.jar -c test.conf &gt; test.log &amp; <\/code><\/pre>\n<p>4 \u3001\u67e5\u770b\u5bfc\u5165 Nebula Graph \u7684\u6570\u636e\u91cf<\/p>\n<pre><code>.\/bin\/db_dump --space=test --db_path=.\/data\/storage\/nebula\/ --meta_server=127.0.0.1:45500 -limit 0 --mode=stat --tags=tagA,tagB --edges=edgeAB <\/code><\/pre>\n<p>\u6ce8\u610f\uff1aNebula 1.x \u7248\u672c\u76ee\u524d\u8fd8\u53ea\u80fd\u7528 db_dump \u7edf\u8ba1\uff0c2.0 \u4f1a\u652f\u6301 nGQL \u547d\u4ee4\u7684\u65b9\u5f0f\u7edf\u8ba1\u6570\u91cf\u3002<\/p>\n<h3>3.2 \u589e\u91cf\u5bfc\u5165<\/h3>\n<p>\u589e\u91cf\u6570\u636e\u5bfc\u5165\u4e3b\u8981\u662f\u901a\u8fc7 Neo4j \u5185\u90e8\u70b9\u548c\u8fb9\u7684\u81ea\u589e <code>id()<\/code> \u8fdb\u884c\u5207\u5272\uff0c\u5728\u5bfc\u5165\u914d\u7f6e\u6587\u4ef6 exec \u9879\u6267\u884c Neo4j Cypher \u8bed\u53e5\u65f6\u589e\u52a0 <code>id()<\/code> \u8303\u56f4\u9650\u5236\uff0c\u4f46\u524d\u63d0\u662f\u9700\u8981\u4e1a\u52a1\u505c\u6389\u5220\u6570\u636e\u64cd\u4f5c\uff0c\u56e0\u4e3a\u589e\u91cf\u5bfc\u5165\u65f6\uff0c\u5982\u679c\u4e4b\u524d\u7684\u6570\u636e\u88ab\u5220\u9664\u540e Neo4j \u4f1a\u590d\u7528 <code>id()<\/code>\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u590d\u7528 <code>id()<\/code> \u7684\u589e\u91cf\u6570\u636e\u5bfc\u5165\u65f6\u67e5\u8be2\u4e0d\u5230\u9020\u6210\u6570\u636e\u4e22\u5931\u3002<strong>\u5f53\u7136\u4e1a\u52a1\u5982\u679c\u6709\u6761\u4ef6\u652f\u6301 Neo4j Nebula \u53cc\u5199\u7684\u8bdd\uff0c\u589e\u91cf\u5bfc\u5165\u5c31\u4e0d\u4f1a\u51fa\u73b0\u8fd9\u79cd\u95ee\u9898<\/strong>\u3002<\/p>\n<pre><code>exec: \"match (n:user) where id(n) &gt;= 300000000 and id(n) &lt; 400000000 return xxx order by id(n)\" <\/code><\/pre>\n<p>\u8bf7\u53c2\u8003\u8bba\u575b\u5e16\u5b50 neo4j \u5230 nebula \u5982\u4f55\u505a\u589e\u91cf\u5bfc\u5165<\/p>\n<h3>3.3 \u5bfc\u5165\u95ee\u9898\u53ca\u89e3\u51b3<\/h3>\n<p>\u4f7f\u7528 Exchange \u5bfc\u5165\u8fc7\u7a0b\u4e2d\u9047\u5230\u4e24\u4e2a\u95ee\u9898\uff0c\u53ca\u65f6\u7684\u5f97\u5230\u5b98\u65b9 @nicole \u7684\u652f\u6301\u548c\u89e3\u51b3\uff0c\u5177\u4f53\u8bf7\u53c2\u8003\u4e0b\u9762\u4e24\u4e2a\u5e16\u5b50\uff1a<\/p>\n<ul>\n<li>nebula \u4ece neo4j \u5bfc\u5165\u6570\u636e\uff0c\u90e8\u5206\u5c5e\u6027\u5e26\u56de\u8f66\uff0c\u62fc insert \u62a5\u9519\uff0c\u6709\u4ec0\u4e48\u597d\u529e\u6cd5\u89e3\u51b3\u5417\uff1f<\/li>\n<li>\u4f7f\u7528 Exchange \u4ece neo4j \u5bfc\u5165 nebula\uff0clabel \u4e2d\u6709\u4e9b\u9876\u70b9\u7684\u5c5e\u6027\u503c\u662f null\uff0c\u5bfc\u81f4\u5bfc\u5165\u5931\u8d25<\/li>\n<\/ul>\n<p>\u95ee\u9898 1\uff1aExchange \u4e0d\u652f\u6301\u300c\u6362\u884c\u56de\u8f66\u300d\u7b49\u7279\u6b8a\u5b57\u7b26\u7684\u8f6c\u4e49\u3002\u5982\u4e0b string \u6570\u636e\u4e2d\u5e26\u6709\u56de\u8f66\uff0c\u5728\u62fc\u63a5 <code>insert<\/code> \u8bed\u53e5\u63d2\u5165\u65f6\u4f1a\u56e0\u4e3a\u6362\u884c\u5bfc\u81f4\u63d2\u5165\u5931\u8d25\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210205_601d1027a1bef.png\" alt=\"Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u603b\u7ed3\" \/><\/p>\n<p>PR\uff1a https:\/\/github.com\/vesoft-inc\/nebula-java\/pull\/203 \u5df2\u7ecf\u5408\u5165 exchange v1.0 \u5206\u652f<\/p>\n<p>\u95ee\u9898 2\uff1aExchange \u4e0d\u652f\u6301\u5c5e\u6027\u4e3a <code>NULL<\/code> \u7684\u6570\u636e\u5bfc\u5165\u3002\u524d\u6587 3.1 \u4e2d\u63d0\u5230\uff0c\u4e1a\u52a1\u53ef\u80fd\u4f1a\u6839\u636e\u4e0d\u540c\u9700\u6c42\u4e3a\u67d0\u4e9b\u70b9\u548c\u8fb9\u589e\u52a0\u5c5e\u6027\uff0c\u8fd9\u65f6\u5176\u4ed6\u70b9\u548c\u8fb9\u5c5e\u6027\u5219\u662f <code>NULL<\/code>\uff0c\u8fd9\u6837\u5728\u4f7f\u7528 Exchange \u5bfc\u5165\u65f6\u4f1a\u62a5\u9519\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210205_601d102d56c02.png\" alt=\"Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u603b\u7ed3\" \/><\/p>\n<p>\u53c2\u8003\u5e16\u5b50 2 \u7ed9\u51fa\u7684\u4fee\u6539\u5efa\u8bae\u89e3\u51b3\uff1a\u4fee\u6539 <code>com.vesoft.nebula.tools.importer.processor.Processor#extraValue<\/code>\uff0c\u589e\u52a0 <code>NULL<\/code> \u7c7b\u578b\u7684\u8f6c\u5316\u503c\u3002<\/p>\n<pre><code>case NullType =&gt; {   fieldTypeMap(field) match {     case StringType =&gt; \"\"     case IntegerType =&gt; 0     case LongType =&gt; 0L     case DoubleType =&gt; 0.0     case BooleanType =&gt; false   } } <\/code><\/pre>\n<h2>4 \u5bfc\u5165\u6548\u7387\u4f18\u5316<\/h2>\n<p>\u5173\u4e8e\u5bfc\u5165\u6548\u7387\u7684\u4f18\u5316\uff0c\u8bf7\u53c2\u8003\u4e0b\u9762\u4e24\u4e2a\u5e16\u5b50\uff1a<\/p>\n<ul>\n<li>\u5173\u4e8e\u4f7f\u7528 Exchange \u4ece neo4j \u5bfc\u5165 nebula \u7684\u6027\u80fd\u95ee\u9898<\/li>\n<li>\u4f7f\u7528 exchange \u5e76\u53d1 spark-submit \u2013master \u201clocal[16]\u201d \u62a5\u9519<\/li>\n<\/ul>\n<p>\u4f18\u5316 1\uff1a\u901a\u8fc7\u9002\u5f53\u589e\u52a0\u5bfc\u5165\u914d\u7f6e\u4e2d\u7684 partition \u548c batch \u503c\uff0c\u63d0\u5347\u5bfc\u5165\u6548\u7387\u3002 \u4f18\u5316 2\uff1a\u5982\u679c\u662f string \u7c7b\u578b\u505a vid \u7684\u8bdd\uff0c1.x \u7248\u672c\u5c3d\u91cf\u4f7f\u7528 hash() \u51fd\u6570\u8f6c\u5316\uff0c2.0 \u7248\u672c\u4f1a\u652f\u6301 string id \u7c7b\u578b\uff1b\u5982\u679c\u662f int \u7c7b\u578b\u505a vid \u7684\u8bdd\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0c\u4e0d\u7528\u8f6c\u5316\u6548\u7387\u66f4\u9ad8\u3002 \u4f18\u5316 3\uff1a\u5b98\u65b9\u5efa\u8bae spark-submit \u63d0\u4ea4\u547d\u4ee4 master \u914d\u7f6e\u6539\u4e3a <code>yarn-cluster<\/code>\uff0c \u82e5\u4e0d\u4f7f\u7528 yarn\uff0c\u53ef\u914d\u7f6e\u6210 <code>spark:\/\/ip:port<\/code>\uff1b\u6211\u4eec\u662f\u901a\u8fc7 <code>spark-submit --master \"local[16]\" <\/code>\u7684\u65b9\u5f0f\u589e\u52a0 spark \u5e76\u53d1\uff0c\u5bfc\u5165\u6548\u7387\u6bd4\u4f7f\u7528 <code>\"local\"<\/code> \u63d0\u5347 4 \u500d+\uff0c\u6d4b\u8bd5\u73af\u5883\u5355\u673a\u4e09\u8282\u70b9 HDD \u76d8 IO \u5cf0\u503c\u80fd\u5230 200-300 MB\/s \u3002\u4f46\u5728\u6307\u5b9a <code>--master \"local[16]\"<\/code> \u5e76\u53d1\u5bfc\u5165\u65f6\u9047\u5230 hadoop \u7f13\u5b58\u95ee\u9898\uff0c\u91c7\u7528\u589e\u52a0 hdfs \u914d\u7f6e <code>fs.hdfs.impl.disable.cache=true<\/code> \u540e\u91cd\u542f hadoop \u89e3\u51b3\u3002\u5177\u4f53\u8bf7\u53c2\u8003\u7b2c\u4e8c\u4e2a\u5e16\u5b50\u3002<\/p>\n<h2>5 \u603b\u7ed3<\/h2>\n<p>\u4f7f\u7528 Exchange \u4ece Neo4j \u5bfc\u5165 Nebula Graph \u8fc7\u7a0b\u4e2d\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u901a\u8fc7\u79ef\u6781\u4e0e\u793e\u533a\u8fdb\u884c\u6c9f\u901a\u5f97\u5230\u4e86\u5b98\u65b9 @nicole \u53ca\u5176\u4ed6\u5c0f\u4f19\u4f34\u7684\u5feb\u901f\u54cd\u5e94\u548c\u5927\u529b\u652f\u6301\uff0c\u8fd9\u4e00\u70b9\u5728 Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u8df5\u8fc7\u7a0b\u4e2d\u8d77\u5230\u4e86\u5341\u5206\u5173\u952e\u7684\u4f5c\u7528\uff0c\u611f\u8c22\u793e\u533a\u7684\u5927\u529b\u652f\u6301\u3002\u671f\u5f85\u652f\u6301 openCypher \u7684 Nebula Graph 2.0 \u3002<\/p>\n<h2>6 \u53c2\u8003\u94fe\u63a5<\/h2>\n<ol>\n<li>https:\/\/nebula-graph.com.cn\/posts\/how-to-import-data-from-neo4j-to-nebula-graph\/<\/li>\n<li>https:\/\/github.com\/vesoft-inc\/nebula-java\/tree\/v1.0<\/li>\n<li>https:\/\/docs.nebula-graph.com.cn\/manual-CN\/2.query-language\/2.functions-and-operators\/uuid\/<\/li>\n<li>http:\/\/arganzheng.life\/hadoop-filesystem-closed-exception.html<\/li>\n<\/ol>\n<h2>\u63a8\u8350\u9605\u8bfb<\/h2>\n<ul>\n<li>\u5728 Spark \u6570\u636e\u5bfc\u5165\u4e2d\u7684\u4e00\u4e9b\u5b9e\u8df5\u7ec6\u8282<\/li>\n<li>Neo4j \u5bfc\u5165 Nebula Graph \u7684\u5b9e\u73b0\u539f\u7406\u4e0e\u5b9e\u8df5<\/li>\n<\/ul><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5193099\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : beyondex <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             SQL Server 2019 \u7684\u56fe\u6570\u636e\u5e93\u6709\u8c01\u5b9e\u9645\u4f7f\u7528\u8fc7\u5417\uff1f\u633a\u65b9\u4fbf\u7684\u8bf6\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Neo4j \u5bfc\u5165 Nebula G&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316966"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=316966"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/316966\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316966"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}