doris odbc连接PostgreSQL外部表异常

环境

CPU: x86_64
操作系统: ArchLinux(单节点, 虚拟机, in vmware workstation 16 player)
Kernel: Linux archlinux 6.2.9-arch1-1
doris docker版本: apache/doris 1.2.1-be-x86_64 apache/doris 1.2.1-fe-x86_64

现象

启动fe和be后, 连接odbc异常

复现流程

1.启动fe和be

docker run -itd \
                       --name=fe \
                       --env FE_SERVERS="fe1:172.20.80.2:9010" \
                       --env FE_ID=1 \
                       -p 8030:8030 \
                       -p 9030:9030 \
                       -v /mnt/disk2/docker_doris/data/fe/doris-meta:/opt/apache-doris/fe/doris-meta \
                       -v /mnt/disk2/docker_doris/data/fe/conf:/opt/apache-doris/fe/conf \
                       -v /mnt/disk2/docker_doris/data/fe/log:/opt/apache-doris/fe/log \
                       --network=doris-network \
                       --ip=172.20.80.2 \
                       apache/doris:1.2.1-fe-x86_64

docker run -itd \
                      --name=be \
                      --env FE_SERVERS="fe1:172.20.80.2:9010" \
                      --env BE_ADDR="172.20.80.3:9050" \
                      -p 8040:8040 \
                      -v /mnt/disk2/docker_doris/data/be/storage:/opt/apache-doris/be/storage \
                      -v /mnt/disk2/docker_doris/data/be/conf:/opt/apache-doris/be/conf \
                      -v /mnt/disk2/docker_doris/data/be/log:/opt/apache-doris/be/log \
                      --network=doris-network \
                      --ip=172.20.80.3 \
                      apache/doris:1.2.1-be-x86_64  

2.进入be安装unixodbc, psqlodbc

3.容器外的宿主机启动PostgreSQL

ip:
  172.20.80.1
port:
  5432
database:
  postgres
user:
  postgres
passwd:
  root

4.在be中通过psql连接PostgreSQL, 成功

5.配置odbc.ini和odbcinst.ini

6.创建外部表

CREATE EXTERNAL TABLE `baseall_pg` (
  `k1` int COMMENT "",
  `k2` char(10) COMMENT "",
  `k3` datetime COMMENT "",
  `k5` varchar(20) COMMENT "",
  `k6` double COMMENT ""
) ENGINE=ODBC
COMMENT "ODBC"
PROPERTIES (
"host" = "172.20.80.1",
"port" = "5432",
"user" = "postgres",
"password" = "root",
"database" = "postgres",
"table" = "tb0",
"driver" = "PostgreSQL Unicode",
"odbc_type" = "postgresql"
);

7.查询外部表

select * from baseall_pg

posted @ 2023-04-04 16:56  一个咸鱼  阅读(221)  评论(0编辑  收藏  举报