Windows下Docker部署是用curl stream load导入数据无法连接到be

Viewed 20

背景交代:

  1. 系统环境:Windows11(amd64),Docker Desktop

  2. docker-compose文件控制,参考官方3fe+3be模式:

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
services:
  docker-fe-01:
    image: "apache/doris:fe-3.0.7"
    container_name: "doris-fe-01"
    hostname: "fe-01"
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - FE_ID=1
    ports:
      - 8031:8030
      - 9031:9030
    volumes:
      - ./data/fe-01/doris-meta:/opt/apache-doris/fe/doris-meta
      - ./data/fe-01/log:/opt/apache-doris/fe/log
      - ./data/fe-01/conf/fe_custom.conf:/opt/apache-doris/fe/conf/fe_custom.conf
    networks:
      doris_net:
        ipv4_address: 172.30.80.2
  docker-fe-02:
    image: "apache/doris:fe-3.0.7"
    container_name: "doris-fe-02"
    hostname: "fe-02"
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - FE_ID=2
    ports:
      - 8032:8030
      - 9032:9030
    volumes:
      - ./data/fe-02/doris-meta:/opt/apache-doris/fe/doris-meta
      - ./data/fe-02/log:/opt/apache-doris/fe/log
      - ./data/fe-01/conf/fe_custom.conf:/opt/apache-doris/fe/conf/fe_custom.conf
    networks:
      doris_net:
        ipv4_address: 172.30.80.3
  docker-fe-03:
    image: "apache/doris:fe-3.0.7"
    container_name: "doris-fe-03"
    hostname: "fe-03"
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - FE_ID=3
    ports:
      - 8033:8030
      - 9033:9030
    volumes:
      - ./data/fe-03/doris-meta:/opt/apache-doris/fe/doris-meta
      - ./data/fe-03/log:/opt/apache-doris/fe/log
      - ./data/fe-01/conf/fe_custom.conf:/opt/apache-doris/fe/conf/fe_custom.conf
    networks:
      doris_net:
        ipv4_address: 172.30.80.4
  docker-be-01:
    image: "apache/doris:be-3.0.7"
    container_name: "doris-be-01"
    hostname: "be-01"
    depends_on:
      - docker-fe-01
      - docker-fe-02
      - docker-fe-03
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - BE_ADDR=172.30.80.5:9050
    ports:
      - 8041:8040
    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
    networks:
      doris_net:
        ipv4_address: 172.30.80.5
  docker-be-02:
    image: "apache/doris:be-3.0.7"
    container_name: "doris-be-02"
    hostname: "be-02"
    depends_on:
      - docker-fe-01
      - docker-fe-02
      - docker-fe-03
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - BE_ADDR=172.30.80.6:9050
    ports:
      - 8042:8040
    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
    networks:
      doris_net:
        ipv4_address: 172.30.80.6
  docker-be-03:
    image: "apache/doris:be-3.0.7"
    container_name: "doris-be-03"
    hostname: "be-03"
    depends_on:
      - docker-fe-01
      - docker-fe-02
      - docker-fe-03
    environment:
      - FE_SERVERS=fe1:172.30.80.2:9010,fe2:172.30.80.3:9010,fe3:172.30.80.4:9010
      - BE_ADDR=172.30.80.7:9050
    ports:
      - 8043:8040
    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
    networks:
      doris_net:
        ipv4_address: 172.30.80.7
networks:
  doris_net:
    ipam:
      config:
        - subnet: 172.30.80.0/24
  1. stream load操作案例:按照官网案例来执行,案例地址:https://doris.apache.org/zh-CN/docs/3.0/data-operate/import/import-way/stream-load-manual 以curl方式载入streamload_example.csv
    3fe+3be容器运行起来之后,在http://localhost:8031/Playground/执行建库语句和建表语句

  2. 执行curl语句:在Windows终端执行curl语句:

curl.exe --location-trusted -u root: -H "Expect:100-continue" -H "column_separator:," -H "columns:user_id,name,age" -T streamload_example.csv -XPUT http://127.0.0.1:8031/api/testdb/test_streamload/_stream_load
  1. 报错信息:
PS C:\docker_app\doris\scripts> curl.exe --location-trusted -u root: -H "Expect:100-continue" -H "column_separator:," -H "columns:user_id,name,age" -T streamload_example.csv -XPUT http://127.0.0.1:8031/api/testdb/test_streamload/_stream_load
curl: (28) Failed to connect to 172.30.80.7 port 8040 after 21037 ms: Could not connect to server
  1. 容器内部:通过docker exec -it doris-fe-01 bash命令进入fe1容器,复制streamload_example.csv文件到容器里,执行curl命令,数据成功导入。
  2. 以上排查怀疑为Windows 宿主机和 Docker 容器网络之间有通信壁垒,应该如何解决?
0 Answers