前两天使用dataX从Oracle向PostgreSQL迁移数据,遇到如下报错:
The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client''s IP address or subnet, and that it is using an authentication scheme supported by the driver.
由于 scram-sha-256 认证加密算法,检查dataX所在主机的JDK版本是1.8,那么就判断应该是 postgresql 的驱动太旧,便将datax重新打包一次,在这记录一下。
1、下载maven
curl -o apache-maven-3.8.1-bin.tar.gz https://downloads.apache.org/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
tar -zxf apache-maven-3.8.1-bin.tar.gz
## settings.xml 修改国内镜像,由于我是在阿里云上打包的,可能有加速,也就没修改国内镜像
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
2、安装JDK
下载JDK上传至/opt目录下:
下载地址:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
tar -zxf jdk-8u162-linux-x64.tar.gz
cp /etc/profile /etc/profile.bak`date +%Y%m%d`
cat >> /etc/profile << EOF
#JAVA zhujialin
export JAVA_HOME=/opt/jdk1.8.0_162
export CLASSPATH=.:\$JAVA_HOME/jre/lib/rt.jar:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
export PATH=\$JAVA_HOME/bin:\$PATH
EOF
source /etc/profile
3、下载源码
git clone git@github.com:alibaba/DataX.git
4、修改pom.xml
因为我的目的只是oracle to pg,因此我将其他的模块都删除了,这样也能避免软件包太大,传输时间太长。
<modules>
<module>common</module>
<module>core</module>
<module>transformer</module>
<module>postgresqlreader</module>
<module>oraclewriter</module>
<module>plugin-rdbms-util</module>
<module>plugin-unstructured-storage-util</module>
<module>hbase20xsqlreader</module>
<module>hbase20xsqlwriter</module>
<module>kuduwriter</module>
</modules>
并且postgresql的驱动太旧,便去 https://mvnrepository.com/ 查找postgresql的jar包。
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.16</version>
</dependency>
找到postgresqlreader模块的pom.xml,将上面的配置替换。
5、打包
export MVN_HOME=/root/shx/datax/apache-maven-3.8.1
cd /root/shx/datax/DataX # 源码下载位置
${MVN_HOME}/bin/mvn -U clean package assembly:assembly -Dmaven.test.skip=true
编译完成即可使用。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




