无法从sql(oracle)中sqoop数据

toiithl6  于 2021-05-29  发布在  Hadoop
关注(0)|答案(2)|浏览(379)

我正在尝试将一个表从oracle导入hdfs(配置单元表)。但我无法完成导入。下面是我使用的命令: sqoop import --hive-import --connect jdbc:oracle:thin:@hostname:port/servicename --table sql_schema.table --username uname --password pwd --hive-table hive_schema.table --num-mappers 1 --verbose 这是我遇到的错误

15/10/12 15:17:21 INFO mapreduce.Job:  map 100% reduce 0%
15/10/12 15:17:21 INFO mapreduce.Job: Task Id : attempt_1444407202506_0022_m_000000_1, Status : FAILED
Error: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
        at org.apache.sqoop.mapreduce.db.DBInputFormat.setConf(DBInputFormat.java:167)
        at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:76)
        at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:749)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.RuntimeException: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
        at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection(DBInputFormat.java:220)
        at org.apache.sqoop.mapreduce.db.DBInputFormat.setConf(DBInputFormat.java:165)
        ... 9 more
Caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at org.apache.sqoop.mapreduce.db.DBConfiguration.getConnection(DBConfiguration.java:302)
        at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection(DBInputFormat.java:213)
        ... 10 more
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
        at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:439)
        at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:454)
        at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:693)
        at oracle.net.ns.NSProtocol.connect(NSProtocol.java:251)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
        ... 18 more
Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:149)
        at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
        at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:405)
        ... 23 more

我尝试从同一台机器连接到oracle,并且成功地从服务器访问了表,但我不确定为什么会出现此io错误:网络适配器无法建立连接错误。
在此方面如有任何帮助,我们将不胜感激。

cqoc49vn

cqoc49vn1#

问题解决了!问题出在dscp标记上。一旦所有数据节点都启用了dscp标记,连接就成功建立!

o2rvlv0m

o2rvlv0m2#

您确定可以从尝试使用sqoop命令的服务器访问数据库吗?
你能在那个端口ping thr oracle hostnsme吗?
上周我也遇到了同样的问题。我的问题是oracle正在运行的端口no在hadoop集群的网关节点上被阻塞了。

相关问题