sqoop与sqlanywhere连接17

k7fdbhmy  于 2021-05-27  发布在  Hadoop
关注(0)|答案(1)|浏览(466)

我想让sqoop和sqlanywhere17一起工作 sajdbc4.jar . 我不断得到的命令库错误无法找到 .so jar需要的相关文件。
现在,我创建了一个 sajdbc4.jar -> /opt/sqlanywhere17/java/sajdbc4.jar 内部 /usr/hdp/current/sqoop-client/lib/ .

ln -s  /opt/sqlanywhere17/java/sajdbc4.jar /usr/hdp/current/sqoop-client/lib/sajdbc4.jar

我得到这个错误:
线程“main”java.lang.unsatifiedLinkError中出现异常:java.library.path中没有dbjdbc17
遵循本指南和本文档后:

cat /opt/sqlanywhere17/bin64/sa_config.sh >> ~/.bashrc
cat /opt/sqlanywhere17/bin64/sa_config.sh >> ~/.bash_profile

检查 echo $LD_LIBRARY_PATH :

/opt/sqlanywhere17/lib64:/opt/sqlanywhere17/bin64/jre180/lib/amd64/client:/opt/sqlanywhere17/bin64/jre180/lib/amd64/server:/opt/sqlanywhere17/bin64/jre180/lib/amd64:/opt/sqlanywhere17/bin64/jre180/lib/amd64/native_threads:

并检查java.library.path以查找: /opt/sqlanywhere17/lib64 ```
java -XshowSettings:properties
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
com.sap.vm.codeline = 81_REL
com.sap.vm.compressedoops = true
com.sap.vm.profilingserver = true
com.sap.vm.type = opt
com.sap.vm.version = 10
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = /opt/sqlanywhere17/bin64/jre180/lib/endorsed
java.ext.dirs = /opt/sqlanywhere17/bin64/jre180/lib/ext-sap
/opt/sqlanywhere17/bin64/jre180/lib/ext
/usr/java/packages/lib/ext
java.home = /opt/sqlanywhere17/bin64/jre180
java.io.tmpdir = /tmp
java.library.path = /opt/sqlanywhere17/lib64
/opt/sqlanywhere17/bin64/jre180/lib/amd64/client
/opt/sqlanywhere17/bin64/jre180/lib/amd64/server
/opt/sqlanywhere17/bin64/jre180/lib/amd64
/opt/sqlanywhere17/bin64/jre180/lib/amd64/native_threads

    /usr/java/packages/lib/amd64
    /usr/lib64
    /lib64
    /lib
    /usr/lib
完全错误:

19/10/22 08:30:05 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.3.0-37
19/10/22 08:30:07 WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
19/10/22 08:30:07 INFO manager.SqlManager: Using default fetchSize of 1000
Exception in thread "main" java.lang.UnsatisfiedLinkError: no dbjdbc17 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sap.jdbc4.sqlanywhere.IDriver.try_load(IDriver.java:451)
at sap.jdbc4.sqlanywhere.IDriver.(IDriver.java:413)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:873)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:64)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:225)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.main(Sqoop.java:243)
[root@server1 dag_scripts]# echo $LD_LIBRARY_PATH
/opt/sqlanywhere17/lib64:/opt/sqlanywhere17/bin64/jre180/lib/amd64/client:/opt/sqlanywhere17/bin64/jre180/lib/amd64/server:/opt/sqlanywhere17/bin64/jre180/lib/amd64:/opt/sqlanywhere17/bin64/jre180/lib/amd64/native_threads:

我找到的唯一解决方法是在运行命令之前更改目录,这是有效的:

cd /opt/sqlanywhere17/lib64
sqoop eval --connect 'jdbc:sqlanywhere:Host=xxx.xx.xx.xxx:2638' --driver sap.jdbc4.sqlanywhere.IDriver --username user --password-file /tmp/pwfile --query "SELECT * from db.table"

yx2lnoni

yx2lnoni1#

此解决方案似乎暂时解决了问题:
选择其中一个 /opt/sqlanywhere17/lib32 或者 /opt/sqlanywhere17/lib64/ 基于32位/64位要求
创建一个指向当前jdk路径和jvm路径的符号链接
打开访问权限 /opt/sqlanywhere17/java/ 如果以root用户身份安装
确保用户是“hadoop”组的一部分-对于sqoop文件夹权限(.env)
将默认导出添加到运行sqoop命令的任何用户

ln -s /opt/sqlanywhere17/lib64/* /usr/jdk64/jdk1.8.0_112/jre/lib/amd64/

ln -s /opt/sqlanywhere17/lib64/* /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-1.el7_7.x86_64/jre/lib/amd64/

chmod 755 -R /opt/sqlanywhere17/*
usermod -a -G hadoop user

# For user executing sqoop:

cat /opt/sqlanywhere17/bin64/sa_config.sh >> ~/.bashrc
cat /opt/sqlanywhere17/bin64/sa_config.sh >> ~/.bash_profile

相关问题