更新时间:2022-12-14 GMT+08:00

Sqoop import 从pg到hive报错

背景

使用sqoop import命令抽取开源postgre到MRS hdfs或hive等。

用户问题

使用sqoop命令查询postgre表可以,但是执行sqoop import命令导入导出时报错:

The authentication type 5 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet。

原因分析

  1. 连接postgresql MD5认证不通过,需要在pg_hba.cnf配置白名单。
  2. 在执行sqoop import命令时,会启动MapReduce任务,由于MRS Hadoop安装目/opt/Bigdata/FusionInsight_HD_*/1_*_DataNode/install/hadoop/share/hadoop/common/lib下自带了postgre驱动包gsjdbc4-*.jar,与开源postgre服务不兼容导致报错。

处理步骤

  1. 客户在pg_hba.cnf配置白名单。
  2. 驱动重复,集群自带,将其余驱动排除出去,所有core节点上的gsjdbc4jar包去掉,在sqoop/lib下添加postgrejar包即可。

    mv /opt/Bigdata/FusionInsight_HD_*/1_*_DataNode/install/hadoop/share/hadoop/common/lib/gsjdbc4-*.jar /tmp