1.5 sqoop安装及基本使用

Posted weiyiming007

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1.5 sqoop安装及基本使用相关的知识,希望对你有一定的参考价值。

一、安装sqoop

1、解压

##解压
[[email protected] cdh]# tar zxf sqoop-1.4.5-cdh5.3.6.tar.gz -C /opt/cdh-5.3.6/


2、/opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/conf/sqoop-env.sh          //先重命名

#Set path to where bin/hadoop is available
export HADOOP_COMMON_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6

#Set path to where hadoop-*-core.jar is available
export HADOOP_MAPRED_HOME=/opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6

#set the path to where bin/hbase is available
#export HBASE_HOME=

#Set the path to where bin/hive is available
export HIVE_HOME=/opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6


3、查看命令帮助

[[email protected] sqoop-1.4.5-cdh5.3.6]# bin/sqoop help

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.


4、拷贝mysql驱动,这里一mysql为例;

[[email protected] sqoop-1.4.5-cdh5.3.6]# cp /opt/softwares/mysql-libs/mysql-connector-java-5.1.27/mysql-connector-java-5.1.27-bin.jar ./lib/


5、sqoop使用要点

技术图片


二、使用

[[email protected] sqoop-1.4.5-cdh5.3.6]# bin/sqoop list-databases > --connect jdbc:mysql://hadoop-senior.ibeifeng.com:3306 > --username root > --password 123456
Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /opt/cdh-5.3.6/sqoop-1.4.5-cdh5.3.6/bin/../../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
19/05/06 15:32:51 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.3.6
19/05/06 15:32:51 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
19/05/06 15:32:51 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
information_schema
metadata
metastore
mysql
performance_schema
test

以上是关于1.5 sqoop安装及基本使用的主要内容,如果未能解决你的问题,请参考以下文章

SQOOP安装及使用

SQOOP安装及使用

SQOOP安装及使用

Sqoop-1.4.6安装部署及详细使用介绍

sqoop安装及导入sqlserver数据

sqoop安装及使用