根据yaml文件创建schema出错

提问参考模版:

  • nebula 版本:v3.4

  • 部署方式:分布式

  • 安装方式:docker-compose

  • 是否为线上版本:N

  • 硬件信息

    • 磁盘( 推荐使用 SSD)
    • CPU、内存信息
  • 问题的具体描述
    使用nebula-importer工具,通过配置yaml文件导入的时候报错(PS:nebula-importer版本没问题,导入过其他的图,可以正常导入)

  • 相关的 meta / storage / graph info 日志信息(尽量使用文本形式方便检索)

2021/11/26 09:52:39 --- START OF NEBULA IMPORTER ---
2021/11/26 09:52:40 [INFO] connection_pool.go:74: [nebula-clients] connection pool is initialized successfully
2021/11/26 09:52:41 Client(0) fails to execute commands (
DROP SPACE IF EXISTS pepper;
CREATE SPACE IF NOT EXISTS pepper(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(1024));
USE pepper;
CREATE TAG DiseaseType(name string);
CREATE TAG CropType3(name string);
CREATE TAG Operation(name string);
CREATE TAG GrowthTime(name string);
CREATE TAG Location(name string);
CREATE TAG CropType4(name string);
CREATE TAG GrowthCondition(name string);
CREATE TAG CropType1(name string);
CREATE TAG CropType2(name string);
CREATE EDGE RelationsGrowthConditions(GrowthTime string,CorrespondingTime string,GrowthForm string,SuitableValue(Lux) string,ExtremeValue(Lux) string,Influence string,Daytime(摄氏度) string,Night(摄氏度) string,IdealRainfall(mm) string,Humidity string,SoilWaterContent string,WaterApplication string,Fertilizer string);
CREATE EDGE RelationsLocation(name string);
CREATE EDGE RelationsDisease(GrowthTime string,AmbientTemperature(摄氏度) string,Humidity(%) string,illumination(Lux) string,WindSpeed(m/s) string,DewPoint(摄氏度) string,OtherConditions string,CompositionCondition string,MajorHazardSymptom string,IntegratedControlProgram string);
CREATE EDGE RelationsSuperClass(name string);
CREATE EDGE RelationsOperation(name string,operation string);
CREATE EDGE RelationsGrowth(name string,CorrespondingTime string,GrowthForm string);), response error code: -1004, message: SyntaxError: syntax error near `D_STRING'

想请问下是我的yaml文件有错误吗? 根据日志找不到什么有价值的东西。以下是我的yaml文件:

version: 2
description: 要导入的图谱描述
removeTempFiles: false
clientSettings:
  retry: 3
  concurrency: 20
  channelBufferSize: 128
  space: pepper
  connection:
    user: root
    password: nebula
    address: 10.6.16.96:9669
  postStart:
    commands: '

      DROP SPACE IF EXISTS pepper;

      CREATE SPACE IF NOT EXISTS pepper(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(1024));

      USE pepper;

      CREATE TAG DiseaseType(name string);

      CREATE TAG CropType3(name string);

      CREATE TAG Operation(name string);

      CREATE TAG GrowthTime(name string);

      CREATE TAG Location(name string);

      CREATE TAG CropType4(name string);

      CREATE TAG GrowthCondition(name string);

      CREATE TAG CropType1(name string);

      CREATE TAG CropType2(name string);

      CREATE EDGE RelationsGrowthConditions(GrowthTime string,CorrespondingTime string,GrowthForm
      string,SuitableValue(Lux) string,ExtremeValue(Lux) string,Influence string,Daytime(摄氏度)
      string,Night(摄氏度) string,IdealRainfall(mm) string,Humidity string,SoilWaterContent
      string,WaterApplication string,Fertilizer string);

      CREATE EDGE RelationsLocation(name string);

      CREATE EDGE RelationsDisease(GrowthTime string,AmbientTemperature(摄氏度) string,Humidity(%)
      string,illumination(Lux) string,WindSpeed(m/s) string,DewPoint(摄氏度) string,OtherConditions
      string,CompositionCondition string,MajorHazardSymptom string,IntegratedControlProgram
      string);

      CREATE EDGE RelationsSuperClass(name string);

      CREATE EDGE RelationsOperation(name string,operation string);

      CREATE EDGE RelationsGrowth(name string,CorrespondingTime string,GrowthForm
      string);'
    afterPeriod: 15s
  preStop:
    commands: ''
logPath: ./err/error.log
files:
- path: DiseaseType.csv
  failDataPath: ./err/DiseaseType.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: DiseaseType
        props:
        - name: name
          type: string
          index: 1
- path: CropType3.csv
  failDataPath: ./err/CropType3.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: CropType3
        props:
        - name: name
          type: string
          index: 1
- path: Operation.csv
  failDataPath: ./err/Operation.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: Operation
        props:
        - name: name
          type: string
          index: 1
- path: GrowthTime.csv
  failDataPath: ./err/GrowthTime.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: GrowthTime
        props:
        - name: name
          type: string
          index: 1
- path: Location.csv
  failDataPath: ./err/Location.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: Location
        props:
        - name: name
          type: string
          index: 1
- path: CropType4.csv
  failDataPath: ./err/CropType4.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: CropType4
        props:
        - name: name
          type: string
          index: 1
- path: GrowthCondition.csv
  failDataPath: ./err/GrowthCondition.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: GrowthCondition
        props:
        - name: name
          type: string
          index: 1
- path: CropType1.csv
  failDataPath: ./err/CropType1.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: CropType1
        props:
        - name: name
          type: string
          index: 1
- path: CropType2.csv
  failDataPath: ./err/CropType2.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: vertex
    vertex:
      vid:
        index: 0
        type: string
      tags:
      - name: CropType2
        props:
        - name: name
          type: string
          index: 1
- path: RelationsGrowthConditions.csv
  failDataPath: ./err/RelationsGrowthConditions.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsGrowthConditions
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 15
      props:
      - name: GrowthTime
        type: string
        index: 2
      - name: CorrespondingTime
        type: string
        index: 3
      - name: GrowthForm
        type: string
        index: 4
      - name: SuitableValue(Lux)
        type: string
        index: 5
      - name: ExtremeValue(Lux)
        type: string
        index: 6
      - name: Influence
        type: string
        index: 7
      - name: Daytime(摄氏度)
        type: string
        index: 8
      - name: Night(摄氏度)
        type: string
        index: 9
      - name: IdealRainfall(mm)
        type: string
        index: 10
      - name: Humidity
        type: string
        index: 11
      - name: SoilWaterContent
        type: string
        index: 12
      - name: WaterApplication
        type: string
        index: 13
      - name: Fertilizer
        type: string
        index: 14
- path: RelationsLocation.csv
  failDataPath: ./err/RelationsLocation.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsLocation
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 3
      props:
      - name: name
        type: string
        index: 2
- path: RelationsDisease.csv
  failDataPath: ./err/RelationsDisease.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsDisease
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 12
      props:
      - name: GrowthTime
        type: string
        index: 2
      - name: AmbientTemperature(摄氏度)
        type: string
        index: 3
      - name: Humidity(%)
        type: string
        index: 4
      - name: illumination(Lux)
        type: string
        index: 5
      - name: WindSpeed(m/s)
        type: string
        index: 6
      - name: DewPoint(摄氏度)
        type: string
        index: 7
      - name: OtherConditions
        type: string
        index: 8
      - name: CompositionCondition
        type: string
        index: 9
      - name: MajorHazardSymptom
        type: string
        index: 10
      - name: IntegratedControlProgram
        type: string
        index: 11
- path: RelationsSuperClass.csv
  failDataPath: ./err/RelationsSuperClass.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsSuperClass
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 3
      props:
      - name: name
        type: string
        index: 2
- path: RelationsOperation.csv
  failDataPath: ./err/RelationsOperation.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsOperation
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 4
      props:
      - name: name
        type: string
        index: 2
      - name: operation
        type: string
        index: 3
- path: RelationsGrowth.csv
  failDataPath: ./err/RelationsGrowth.csv
  batchSize: 2048
  inOrder: false
  type: csv
  csv:
    withHeader: false
    withLabel: false
    delimiter: ','
  schema:
    type: edge
    edge:
      name: RelationsGrowth
      withRanking: true
      srcVID:
        type: string
        index: 0
      dstVID:
        type: string
        index: 1
      rank:
        index: 5
      props:
      - name: name
        type: string
        index: 2
      - name: CorrespondingTime
        type: string
        index: 3
      - name: GrowthForm
        type: string
        index: 4

最后想请问一下:
1.yaml文件导入的时候需要注意些什么吗? 好像官方文档里面没有这方面的说明。(比如属性命名不能有value? 比如创建TAG和EDGE的时候不能有下划线?)
2.很多时候根据日志根本找不到问题,捕获感觉可以再优化一下

可以把:

  postStart:
    commands: '
      DROP SPACE IF EXISTS importer_test;
      CREATE SPACE IF NOT EXISTS importer_test(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(10));
      USE importer_test;
      CREATE TAG course(name string, credits int);'

改成 | 的么?两者都是合法的 YAML ,但是后者表示多行 String,前者表示单行。

  postStart:
    commands: |
      DROP SPACE IF EXISTS importer_test;
      CREATE SPACE IF NOT EXISTS importer_test(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(10));
      USE importer_test;
      CREATE TAG course(name string, credits int);

改了貌似也不是这个原因,没有影响。 我把yaml中 commands(即创建schema命令)的中文全部改成英文,且把其中的特殊字符比如(), /, %去掉就可以了。用ngql创建tag、edge是不能含有中文或者特殊字符吗?

哦,是的哈, tag, edge 定义DDL中不能有 UTF-8 字符,插入的数据 value 支持。
我以为您的那些 commands 已经在 console 里测试过了,这个和 importer 没关系

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。