通过Flink-doris-connector Flink查询doris表数据报错

Viewed 116

版本信息:
Flink:1.18.1
Git : file://VM-10-14-centos@Unknown
Version : doris-2.0.0-alpha1
BuildInfo : VM-10-14-centos
BuildTime : Mon, 01 May 2023 15:05:04 UTC
Flink-doris-connector: flink-doris-connector-1.18:1.5.2

代码:官网提供的代码,port设置为9031(9031:9030),doris通过docker部署,fe和be在同一个服务器上。
image.png

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DorisOptions.Builder builder = DorisOptions.builder()
        .setFenodes("FE_IP:9031")
        .setTableIdentifier("demo.orders")
        .setUsername("root")
        .setPassword("");

DorisSource<List<?>> dorisSource = DorisSourceBuilder.<List<?>>builder()
        .setDorisOptions(builder.build())
        .setDorisReadOptions(DorisReadOptions.builder().build())
        .setDeserializer(new SimpleListDeserializationSchema())
        .build();

env.fromSource(dorisSource, WatermarkStrategy.noWatermarks(), "doris source").print();

报错信息:
image.png

通过pymysql可以正常查询数据
image.png

补充docker yaml文件信息,需要提前创建docker网络:docker network create --driver bridge --subnet=xx.xx.xx.0/24 doris-network

services:
  doris-fe:
    image: apache/doris:2.0.0_alpha-fe-x86_64
    hostname: doris-fe
    container_name: doris-fe
    environment:
     - FE_SERVERS=fe1:xx.xx.xx.32:9010
     - FE_ID=1
    volumes:
     - /data/fe/doris-meta/:/opt/apache-doris/fe/doris-meta/
     - /data/fe/log/:/opt/apache-doris/fe/log/
    ports:
      - 8031:8030
      - 9031:9030
    networks:
      doris-network:
        ipv4_address: xx.xx.xx.32
  doris-be1:
    image: apache/doris:2.0.0_alpha-be-x86_64
    container_name: doris-be1
    hostname: doris-be1
    environment:
     - FE_SERVERS=fe1:xx.xx.xx.32:9010
     - BE_ADDR=xx.xx.xx.33:9050
    volumes:
     - /data/be-01/storage/:/opt/apache-doris/be/storage/
     - /data/be-01/script/:/docker-entrypoint-initdb.d/
     - /data/be-01/log:/opt/apache-doris/be/log
    depends_on:
      - doris-fe
    ports:
      - 8041:8040
    networks:
      doris-network:
        ipv4_address: xx.xx.xx.33
  doris-be2:
    image: apache/doris:2.0.0_alpha-be-x86_64
    container_name: doris-be2
    hostname: doris-be2
    environment:
     - FE_SERVERS=fe1:xx.xx.xx.32:9010
     - BE_ADDR=xx.xx.xx.34:9050
    volumes:
     - /data/be-02/storage/:/opt/apache-doris/be/storage/
     - /data/be-02/script/:/docker-entrypoint-initdb.d/
     - /data/be-02/log:/opt/apache-doris/be/log
    depends_on:
      - doris-fe
    ports:
      - 8042:8040
    networks:
      doris-network:
        ipv4_address: xx.xx.xx.34
  doris-be3:
    image: apache/doris:2.0.0_alpha-be-x86_64
    container_name: doris-be3
    hostname: doris-be3
    environment:
     - FE_SERVERS=fe1:xx.xx.xx.32:9010
     - BE_ADDR=xx.xx.xx.35:9050
    volumes:
     - /data/be-03/storage/:/opt/apache-doris/be/storage/
     - /data/be-03/script/:/docker-entrypoint-initdb.d/
     - /data/be-03/log:/opt/apache-doris/be/log
    depends_on:
      - doris-fe
    ports:
      - 8043:8040
    networks:
      doris-network:
        ipv4_address: xx.xx.xx.35
networks:
  doris-network:
    external: true
1 Answers

使用Doris连接器,setFenodes要配置8030端口而不是9030