Exchange 2.0 导入数据报 TProtocolException

  • nebula 版本:
  • 部署方式:Docker:
  • Exchange 版本:2.0.0
  • 问题的具体描述
    使用 Exchange 向 Nebula Graph 中导入 HDFS 上的 CSV 格式数据时报错:
Exception in thread "main" com.facebook.thrift.protocol.TProtocolException: Expected protocol id ffffff82 but got 48
	at com.facebook.thrift.protocol.TCompactProtocol.readMessageBegin(TCompactProtocol.java:475)
	at com.vesoft.nebula.meta.MetaService$Client.recv_getSpace(MetaService.java:511)
	at com.vesoft.nebula.meta.MetaService$Client.getSpace(MetaService.java:488)
	at com.vesoft.nebula.client.meta.MetaClient.getSpace(MetaClient.java:131)
	at com.vesoft.nebula.client.meta.MetaClient.getTags(MetaClient.java:144)
	at com.vesoft.nebula.exchange.MetaProvider.getLabelType(MetaProvider.scala:69)
	at com.vesoft.nebula.exchange.utils.NebulaUtils$.getDataSourceFieldType(NebulaUtils.scala:29)
	at com.vesoft.nebula.exchange.processor.VerticesProcessor.process(VerticesProcessor.scala:110)
	at com.vesoft.nebula.exchange.Exchange$$anonfun$main$2.apply(Exchange.scala:140)
	at com.vesoft.nebula.exchange.Exchange$$anonfun$main$2.apply(Exchange.scala:117)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at com.vesoft.nebula.exchange.Exchange$.main(Exchange.scala:117)
	at com.vesoft.nebula.exchange.Exchange.main(Exchange.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
	at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:923)
	at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:164)
	at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:187)
	at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:89)
	at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:998)
	at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1008)
	at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

application.conf 配置

{
  # Spark 相关配置
  spark: {
    app: {
      name: Spark Writer
    }
    driver: {
      cores: 1
      maxResultSize: 1G
    }
    cores {
      max: 16
    }
  }
  # Nebula Graph 相关配置
  nebula: {
    address:{
      # 以下为 Nebula Graph 的 Graph 服务和 Meta 服务所在机器的 IP 地址及端口
      # 如果有多个地址,格式为 "ip1:port","ip2:port","ip3:port"
      # 不同地址之间以英文逗号 (,) 隔开
      graph:[...]
      meta:[...]
    }
    # 填写的账号必须拥有 Nebula Graph 相应图空间的写数据权限
    user: root
    pswd: nebula
    # 填写 Nebula Graph 中需要写入数据的图空间名称
    space: csv_test
    connection {
      timeout: 3000
      retry: 3
    }
    execution {
      retry: 3
    }
    error: {
      max: 32
      output: /tmp/errors
    }
    rate: {
      limit: 1024
      timeout: 5000
    }
  }
  # 处理标签
  tags: [
    # 设置标签 user 相关信息
    {
      name: user
      type: {
        source: csv
        sink: client
      }
      path: "hdfs://ns....csv"
      fields: [_c0, _c1, _c2]
      nebula.fields: [vid, user_pin, c_time]
      vertex: {
        field: _c0,
      }
      separator: ","
      header: false
      batch: 256
      partition: 1
      isImplicit: true
    }
  ]
}

麻烦路过的大佬们帮忙看一下~~~

补充一下 Nebula Graph 中的 Schema:

我安装的metad服务端口号是9559,当我在配置文件中把address.metad 故意配错成19559时出现了TProtocolException的问题。
你先通过docker-compose ps查看下端口号,检查下配置文件中配的端口是否正确。

1 个赞
nebula-docker-compose_metad0_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:49192->19559/tcp, 0.0.0.0:49190->19560/tcp, 0.0.0.0:49193->9559/tcp, 9560/tcp
nebula-docker-compose_metad1_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:49189->19559/tcp, 0.0.0.0:49188->19560/tcp, 0.0.0.0:49191->9559/tcp, 9560/tcp
nebula-docker-compose_metad2_1      ./bin/nebula-metad --flagf ...   Up (healthy)   0.0.0.0:49186->19559/tcp, 0.0.0.0:49185->19560/tcp, 0.0.0.0:49187->9559/tcp, 9560/tcp

metad 的服务是这三个,请问配置文件里应该怎么配呢?

0.0.0.0:49193->9559/tcp
0.0.0.0:49191->9559/tcp
0.0.0.0:49187->9559/tcp

外部访问docker中metad服务的端口是 49193、49191、49187

噢噢,确实是我在配置文件中配的端口不对,我把 49185 - 49193 这九个端口都配上了 :sweat:。改过来之后可以啦~多谢
另外多问一句,19559 和 19560 这两个端口是用来做什么的呢?有可以学习的文档嘛?

ws_http_port=19559 是HTTP协议监听端口
可以参考文档: Graphd 配置 - Nebula Graph Database 手册

1 个赞

好的,非常感谢~

浙ICP备20010487号