SkrDrag opened a new issue, #2416:
URL: https://github.com/apache/incubator-hugegraph/issues/2416

   ### Problem Type (问题类型)
   
   None
   
   ### Before submit
   
   - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 
[FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have 
confirmed and searched that there are no similar problems in the historical 
issue and documents)
   
   ### Environment (环境信息)
   
   - Server Version: 1.5.0 (Apache Release Version)
   - Backend: Mysql
   - OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x 
   - Data Size:  xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
   
   
   ### Your Question (问题描述)
   
   我一开始选择的后端是Rocksdb,且数据库和Server在同一台机器上。数据导入时没有问题。
   
之后我选择在另一台机器上存储后端数据库mysql,通过配置Server远程连接mysql数据库,初始化成功并成功启动Server。我在存储数据库的机器上使用loader导入数据,报错
   
   运行脚本:bin/hugegraph-loader.sh -g hugegraph -f /home/llw/dataset/struct.json 
-s /home/llw/dataset/schema.groovy -h 210.45.124.72 
   日志:
   SLF4J: Class path contains multiple SLF4J bindings.
   SLF4J: Found binding in 
[jar:file:/home/llw/apache-hugegraph-toolchain-incubating-1.2.0/apache-hugegraph-loader-incubating-1.2.0/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: Found binding in 
[jar:file:/home/llw/apache-hugegraph-toolchain-incubating-1.2.0/apache-hugegraph-loader-incubating-1.2.0/lib/apache-hugegraph-loader-incubating-1.2.0-shaded.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: Found binding in 
[jar:file:/home/llw/apache-hugegraph-toolchain-incubating-1.2.0/apache-hugegraph-loader-incubating-1.2.0/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.
   SLF4J: Actual binding is of type 
[org.apache.logging.slf4j.Log4jLoggerFactory]
   WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will 
impact performance.
   WARNING: An illegal reflective access operation has occurred
   WARNING: Illegal reflective access by 
org.codehaus.groovy.reflection.CachedClass 
(file:/home/llw/apache-hugegraph-toolchain-incubating-1.2.0/apache-hugegraph-loader-incubating-1.2.0/lib/apache-hugegraph-loader-incubating-1.2.0-shaded.jar)
 to method java.lang.Object.finalize()
   WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.reflection.CachedClass
   WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
   WARNING: All illegal access operations will be denied in a future release
   
   Failed to load, cause: Not all index fields '[id]' are contained in schema 
properties '[ID, CODE, NAME, TYPE, length]'
   
   我的问题:
   1.我期望Server和后端数据库在两个不同的结点上,如何使用loader向数据库中导入数据,正确的步骤是什么。
   2.报这个错误是因为映射文件错误吗?应该如何修改?
   
   schema.groovy:
   schema.propertyKey("ID").asText().ifNotExist().create();
   schema.propertyKey("CODE").asText().ifNotExist().create();
   schema.propertyKey("NAME").asText().ifNotExist().create();
   schema.propertyKey("TYPE").asText().ifNotExist().create();
   
   schema.propertyKey("id").asText().ifNotExist().create();
   schema.propertyKey("code").asText().ifNotExist().create();
   schema.propertyKey("name").asText().ifNotExist().create();
   schema.propertyKey("type").asText().ifNotExist().create();
   schema.propertyKey("aid").asText().ifNotExist().create();
   schema.propertyKey("zid").asText().ifNotExist().create();
   schema.propertyKey("length").asFloat().ifNotExist().create();
   
   
   schema.vertexLabel("device")
         .properties("ID","CODE","NAME","TYPE")
         .primaryKeys("ID")
         .nullableKeys("NAME")
         .ifNotExist()
         .create();
   
   
   schema.edgeLabel("link")
         .sourceLabel("device")
         .targetLabel("device")
         .properties("id","code","name","type","length")
         .nullableKeys("code","name","type")
         .ifNotExist()
         .create();
   
   schema.indexLabel("personByCityAndAge").
         onE("link").
         by("length").
         range().
         ifNotExist()
         .create();
   
   schema.indexLabel("deviceByType")
         .onV("device")
         .by("TYPE")
         .secondary()
         .ifNotExist()
         .create();
   
   schema.indexLabel("linkByType")
         .onE("link")
         .by("id")
         .secondary()
         .ifNotExist()
         .create();
   
   struct .json:
   
   {
     "vertices": [
       {
         "label": "device",
         "input": {
           "type": "file",
           "path": "/home/llw/dataset/dev.csv",
           "header": ["ID","CODE","NAME","TYPE"],
           "format": "CSV",
           "charset": "UTF-8"
         }
       }
     ],
     "edges": [
       {
         "label": "link",
         "source": ["aid"],
         "target": ["zid"],
         "input": {
           "type": "file",
           "path": "/home/llw/dataset/link.csv",
           "format": "CSV",
           "header":["id","code","name","type","aid","zid","length"]
         },
         "field_mapping": {
           "aid": "ID",
           "zid": "ID"
         }
       },
       {
         "label": "link",
         "source": ["zid"],
         "target": ["aid"],
         "input": {
           "type": "file",
           "path": "/home/llw/dataset/link.csv",
           "format": "CSV",
           "header":["id","code","name","type","aid","zid","length"]
         },
         "field_mapping": {
           "aid": "ID",
           "zid": "ID"
         }
       }
     ]
     
   }
   
     
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   _No response_
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to