Sqoop的使用幫助

# 查看命令幫助

[hadoop@hadoop ~]$ sqoop help

20/06/06 18:07:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.16.2

usage: sqoop COMMAND [ARGS]

Available commands:

? codegen? ? ? ? ? ? Generate code to interact with database records

? create-hive-table? Import a table definition into Hive

? eval? ? ? ? ? ? ? Evaluate a SQL statement and display the results

? export? ? ? ? ? ? Export an HDFS directory to a database table

? help? ? ? ? ? ? ? List available commands

? import? ? ? ? ? ? Import a table from a database to HDFS

? import-all-tables? Import tables from a database to HDFS

? import-mainframe? Import datasets from a mainframe server to HDFS

? job? ? ? ? ? ? ? ? Work with saved jobs

? list-databases? ? List available databases on a server

? list-tables? ? ? ? List available tables in a database

? merge? ? ? ? ? ? ? Merge results of incremental imports

? metastore? ? ? ? ? Run a standalone Sqoop metastore

? version? ? ? ? ? ? Display version information

See 'sqoop help COMMAND' for information on a specific command.

# 查看命令的參數(shù)

[hadoop@hadoop ~]$ sqoop help list-databases

#使用sqoop獲取數(shù)據(jù)庫的列表

[hadoop@hadoop ~]$ sqoop list-databases \

> --connect jdbc:mysql://192.168.228.128:3306 \

> --username root \

> --password root

20/06/06 18:51:16 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.16.2

20/06/06 18:51:16 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

20/06/06 18:51:16 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

Sat Jun 06 18:51:17 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

information_schema

mysql

performance_schema

sys

# 使用sqoop導(dǎo)數(shù)據(jù)到hadoop

[hadoop@hadoop ~]$ sqoop import \

> --connect jdbc:mysql://192.168.228.128:3306/ruozedata \

> --username root \

> --password root \

> --table sqoop_test

出現(xiàn)如下錯(cuò)誤,很明顯,就是缺少jar包,參考https://community.cloudera.com/t5/Support-Questions/Sqoop-import-exception-java-lang-NoClassDefFoundError-org/td-p/50758,下載到對(duì)應(yīng)的jar包放入$SQOOP_HOME/lib下即可

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容