我尝试在Linux上使用sqoop1.4.6将数据从postgres9.3导入hadoop2.7.2。
当我使用以下代码时,它会返回正确的内容。
sqoop-list-databases --connect jdbc:postgresql://localhost:5432/ --username postgres --password "baixinghehe"
以下结果显示用户名和密码均正常。
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
16/07/09 15:39:50 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
16/07/09 15:39:50 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/07/09 15:39:50 INFO manager.SqlManager: Using default fetchSize of 1000
template1
template0
postgres
learnflask
当我想使用sqoop导入时,如下面的代码。
sqoop import --connect jdbc:postgresql://localhost:5432/learnflask --username postgres --password baixinghehe --table employee --target-dir /data/employee -m 1
它首先运行正常,直到地图部分。这是错误。我真的很奇怪,因为如果密码错误,程序不应该转到mapreduce部分。有人可以帮忙吗?非常感谢。
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
16/07/09 15:35:02 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
16/07/09 15:35:02 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/07/09 15:35:02 INFO manager.SqlManager: Using default fetchSize of 1000
16/07/09 15:35:02 INFO tool.CodeGenTool: Beginning code generation
16/07/09 15:35:03 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM "employee" AS t LIMIT 1
16/07/09 15:35:03 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop
注: /tmp/sqoop-chenxuyuan/compile/b54e25a7f52c8eb496b2b84945ecd05a/employee.java.Use replace the old api
Using -Xlint:deprecation to recompile
16/07/09 15:35:06 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-chenxuyuan/compile/b54e25a7f52c8eb496b2b84945ecd05a/employee.jar
16/07/09 15:35:06 WARN manager.PostgresqlManager: It looks like you are importing from postgresql.
16/07/09 15:35:06 WARN manager.PostgresqlManager: This transfer can be faster! Use the --direct
16/07/09 15:35:06 WARN manager.PostgresqlManager: option to exercise a postgresql-specific fast path.
16/07/09 15:35:06 INFO mapreduce.ImportJobBase: Beginning import of employee
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
16/07/09 15:35:06 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
16/07/09 15:35:07 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
16/07/09 15:35:07 INFO client.RMProxy: Connecting to ResourceManager at cxy10/192.168.0.110:8032
16/07/09 15:35:33 INFO db.DBInputFormat: Using read commited transaction isolation
16/07/09 15:35:33 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN("id"), MAX("id") FROM "employee"
16/07/09 15:35:33 INFO mapreduce.JobSubmitter: number of splits:2
16/07/09 15:35:34 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1468047672859_0003
16/07/09 15:35:35 INFO impl.YarnClientImpl: Submitted application application_1468047672859_0003
16/07/09 15:35:35 INFO mapreduce.Job: The url to track the job: http://cxy10:8088/proxy/application_1468047672859_0003/
16/07/09 15:35:35 INFO mapreduce.Job: Running job: job_1468047672859_0003
16/07/09 15:35:46 INFO mapreduce.Job: Job job_1468047672859_0003 running in uber mode : false
16/07/09 15:35:46 INFO mapreduce.Job: map 0% reduce 0%
16/07/09 15:35:55 INFO mapreduce.Job: Task Id : attempt_1468047672859_0003_m_000000_0, Status : FAILED
Error: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
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:415)
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: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
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: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:415)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:188)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:143)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
at org.postgresql.jdbc3g.Jdbc3gConnection.<init>(Jdbc3gConnection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:412)
at org.postgresql.Driver.connect(Driver.java:280)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at org.apache.sqoop.mapreduce.db.DBConfiguration.getConnection(DBConfiguration.java:302)
at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection(DBInputFormat.java:213)
... 10 more