博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【大数据之sqoop安装】
阅读量:6082 次
发布时间:2019-06-20

本文共 4276 字,大约阅读时间需要 14 分钟。

  hot3.png

Sqoop(发音:skup)是一款开源的工具,主要用于在Hadoop(Hive)与传统的数据库(mysql、postgresql...)间进行数据的传递,可以将一个关系型数据库(例如 : MySQL ,Oracle ,Postgres等)中的数据导进到Hadoop的HDFS中,也可以将HDFS的数据导进到关系型数据库中。

 

一、安装

[root@hadoop0 opt]# tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz 

[root@hadoop0 opt]# clear

[root@hadoop0 opt]# ls

apache-storm-0.9.6.tar.gz  elasticsearch-2.3.3      jdk1.7.0_79             redis-3.2.0         scala-2.10.5           spark-1.3.1-bin-hadoop2.6.tgz               zookeeper-3.4.6.tar.gz   bigdata                    

elasticsearch-2.3.3.zip  kafka_2.11-0.9.0.1.tgz  redis-3.2.0.tar.gz  scala-2.10.5.tgz          

sqoop-1.4.6.bin__hadoop-2.0.4-alpha hadoop-2.7.2.tar.gz      ORCLfmap                rh                  spark-1.3.1-bin-hadoop2.6  sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz

[root@hadoop0 opt]# mv sqoop-1.4.6.bin__hadoop-2.0.4-alpha sqoop-1.4.6

[root@hadoop0 opt]# cd sqoop-1.4.6/bin/

[root@hadoop0 bin]# ./sqoop list-tables --connect jdbc:mysql://192.168.1.102:3306/taokeeper --username root --password  123456

Warning: /opt/sqoop-1.4.6/bin/../../hcatalog does not exist! HCatalog jobs will fail.

Please set $HCAT_HOME to the root of your HCatalog installation.

Warning: /opt/sqoop-1.4.6/bin/../../accumulo does not exist! Accumulo imports will fail.

Please set $ACCUMULO_HOME to the root of your Accumulo installation.

Warning: /opt/sqoop-1.4.6/bin/../../zookeeper does not exist! Accumulo imports will fail.

Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.

99/04/29 18:46:52 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6

99/04/29 18:46:52 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

99/04/29 18:46:52 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

99/04/29 18:46:52 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver

java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver

        at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:856)

        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)

        at org.apache.sqoop.manager.CatalogQueryManager.listTables(CatalogQueryManager.java:102)

        at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)

        at org.apache.sqoop.Sqoop.run(Sqoop.java:143)

        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)

        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)

        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)

        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)

        at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

解决方案:拷贝数据库驱动包到sqoop-1.4.6/lib中

 

[root@hadoop0 bin]# ./sqoop list-tables --connect jdbc:mysql://192.168.1.102:3306/taokeeper --username root --password  123456

Warning: /opt/sqoop-1.4.6/bin/../../hcatalog does not exist! HCatalog jobs will fail.

Please set $HCAT_HOME to the root of your HCatalog installation.

Warning: /opt/sqoop-1.4.6/bin/../../accumulo does not exist! Accumulo imports will fail.

Please set $ACCUMULO_HOME to the root of your Accumulo installation.

Warning: /opt/sqoop-1.4.6/bin/../../zookeeper does not exist! Accumulo imports will fail.

Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.

99/04/29 18:47:56 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6

99/04/29 18:47:56 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.

99/04/29 18:47:56 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

alarm_settings

taokeeper_settings

taokeeper_stat

zookeeper_cluster

[root@hadoop0 bin]# cat ~/.bash_profile 

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

JAVA_HOME=/opt/jdk1.7.0_79

STORM_HOME=/opt/bigdata/stomr096

HIVE_HOME=/opt/bigdata/hive2.0

HADOOP_HOME=/opt/bigdata/hadoop272

HBASE_HOME=/opt/bigdata/hbase-1.1.5

 

PATH=$PATH:$JAVA_HOME/bin:$STORM_HOME/bin:$HIVE_HOME/bin:$HADOOP_HOME/bin:$HBASE_HOME/bin

export JAVA_HOME STORM_HOME HIVE_HOME HADOOP_HOME HBASE_HOME

export PATH 

 

 

 

export SCALA_HOME=/opt/scala-2.10.5

export PATH=.:$SCALA_HOME/bin:$PATH

 

export HADOOP_COMMON_LIB_NATIVE_DIR=/opt/bigdata/hadoop272/lib/native

export HADOOP_OPTS="-Djava.library.path=/opt/bigdata/hadoop272/lib"

[root@hadoop0 bin]# 

 

二、验证

 

 

 

 

转载于:https://my.oschina.net/boltwu/blog/703838

你可能感兴趣的文章
MySql 开发实用笔记 2015-08-27
查看>>
GO 中常见的 flag 和 函数
查看>>
APM for .NET评测系列:OneAPM vs SCOM
查看>>
小代码
查看>>
ios页面返回上层页面数据没有更新,可以在上层页面强制加入监听进行更新
查看>>
puppeteer尝试-爬链家
查看>>
如何写出无法维护的代码?
查看>>
MySQL字符集详解
查看>>
netty报错:io.netty.channel.ChannelPipelineException
查看>>
ThinkPHP RBAC如何自动获取所有模块的函数
查看>>
Android学习--06-活动的启动模式
查看>>
Apache Shiro 快速入门实例
查看>>
mysql增删改查
查看>>
Mariadb基于ssl的主从复制
查看>>
WAMP下Apache配置httpd-vhosts虚拟主机多站点
查看>>
intellij idea 使用指南(mac 版)
查看>>
常用的监测系统状态shell脚本
查看>>
sed工具
查看>>
Why Namespace? - 每天5分钟玩转 OpenStack(102)
查看>>
Nginx 常用全局变量
查看>>