【发布时间】:2019-01-06 10:50:16
【问题描述】:
我使用 sqoop 命令创建了一个 hive 内部表。
sqoop import -Dmapreduce.map.memory.mb=4096
--driver com.mysql.jdbc.Driver
--connect 'jdbc:mysql://{mysql_url}'
--username 'xxxx'
--password 'xxxx'
--input-fields-terminated-by '\t'
--split-by id
--target-dir {hdfs_path}
--verbose -m 1
--hive-drop-import-delims
--fields-terminated-by '\t'
--hive-import
--hive-table '{table_name}'
--query "select id from temp WHERE \$CONDITIONS LIMIT 10"
我在其中创建了一个表,它正在查找。
19/01/06 19:33:44 DEBUG hive.TableDefWriter: Load statement: LOAD DATA INPATH 'hdfs://hadoop/{hdfs_path}' INTO TABLE `tmp.temp`
19/01/06 19:33:44 INFO hive.HiveImport: Loading uploaded data into Hive
19/01/06 19:33:44 DEBUG hive.HiveImport: Using in-process Hive instance.
19/01/06 19:33:44 DEBUG util.SubprocessSecurityManager: Installing subprocess security manager
Logging initialized using configuration in jar:file:${HADOOP_HOME}/hive-1.1.0-cdh5.14.2/lib/hive-common-1.1.0-cdh5.14.2.jar!/hive-log4j.properties
它在 hdfs 仓库位置创建。
$ hadoop dfs -ls {hdfs_path}
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
19/01/06 19:43:23 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
0 2019-01-06 19:33 {hdfs_path}/_SUCCESS
65 2019-01-06 19:33 {hdfs_path}/part-m-00000.gz
但这是一个错误:
FAILED: SemanticException [Error 10072]: Database does not exist: tmp
我已经将 hive-site.xml 放入 sqoop conf 目录。
cp ${HIVE_HOME}/conf/hive-site.xml ${SQOOP_HOME}/conf/hive-site.xml
“hive.metastore.uris”被设置为本地和远程thrift。
我该怎么做?帮我。谢谢
【问题讨论】:
-
{table_name}的值是多少,没有找到mysql表和数据库的信息。 -
{table_name} 是 hive 表。
-
是的,我可以说,我在问确切的值是什么,它是否包含表名或带有数据库的表?
-
所以需要指定--hive-database子句将sqoop中的数据导入hive。