nebualGraph 2.0.0 spark 导不出数据问题

Nebula2.0.1 和Exchange 2.0.0

       val nebulaReadVertexConfig: ReadNebulaConfig = ReadNebulaConfig
      .builder()
      .withSpace( param.space)
      .withLabel(name)
      .withNoColumn(false)
      .withReturnCols(List("spaceName", "schemaType", "name", "taskId", "num"))
      .withLimit(100)
      .withPartitionNum(10)
      .build()
      

     val tagDataset= sparkSession.read.nebula(config, nebulaReadVertexConfig).loadVerticesToDF()
//        val tagDataset: Dataset[Row] = reader.loadVerticesToDF(name, "*")
        tag.setFields(tagDataset.columns.mkString(", ")) 
        tag.setPath(param.path + "/Tag_" + name) 
        tag.setIdName("_vertexId")
        println("tag name is " + tag.getName + ", tag fields is " + tag.getFields)
        println("tag name is "+tag.getPath)
        //println("tag name is "+tagDataset)
        //statistic.num = tagDataset.count()
      
        tagDataset.printSchema()
        tagDataset.show(1)
        tagList.append(tag)
        println("=====count==="+String.valueOf( tagDataset.count()));
        println("======"+tag)
        tagDataset.write.option("header", "true").option("seq", seq).format("csv").save(tag.getPath)

报错:21/04/29 15:46:14 WARN DFSClient: DFSOutputStream ResponseProcessor exception  for block BP-1109931589-10.12.180.29-1536716072073:blk_6872991669_6049197242
java.io.EOFException: Premature EOF: no length prefix available
	at org.apache.hadoop.hdfs.protocolPB.PBHelper.vintPrefixed(PBHelper.java:2305)
	at org.apache.hadoop.hdfs.protocol.datatransfer.PipelineAck.readFields(PipelineAck.java:235)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer$ResponseProcessor.run(DFSOutputStream.java:1093)

tagDataset.printSchema() 有数据日志
tagDataset.show(1) 没数据日志卡主不动

Nebula2.0.1 和Exchange 2.0.0

你把要读的tag 通过 console 执行 desc tag $tag_name 结果截图

这是pringSchema 打出的日志, 字段都没有问题, 就是获取不到数据show(1) 直接卡主了,没有日志


找到了这些日志,帮看看什么问题

 .withReturnCols(List("spaceName", "schemaType", "name", "taskId", "num"))

你这里的returncols是你真实的tag信息吗?看着不像,你把要查询的 tag的属性通过console查询,然后把结果贴出来。


找到的错误日志,和字段

你这个是因为你执行spark的环境识别不了docker内部的域名,所以解析不了storage1的域名,所以读不了数据,你可以把docker环境配置成host模式,让你的spark可以直接访问docker里面的storage的ip

val config =NebulaConnectionConfig
.builder()
.withMetaAddress(“10.38.42.143:9559,10.38.42.143:9569,10.38.42.143:9579”)
.withConenctionRetry(2)
.build()
代码里我是直接连的MetaAddress ip ,不是域名 ,spark 通过meta 调用storage 不能获取 这个ip吗??

spark 通过meta获取到storage的信息,就跟你执行 show hosts 出来的 storage 信息是一致的。

大概理解了,那就是说吧docker-compose .xml 中的networks:nebula-net 改成networks:host 吗

我在下载的docker-compose.xml 配置了 提示集群没法设置host,该怎么设置呀,有案例吗