1.解压Sqoop安装包
(1)解压Sqoop安装包到指定位置 /opt//module
tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /opt/module/
sqoop版本与hadoop匹配
(2)修改名字为sqoop
mv sqoop-1.4.6.bin__hadoop-2.0.4-alpha/ sqoop
2. 配置环境变量
sudo vim /etc/profilr.d/
添加:
#SQOOP_HOME
export SQOOP_HOME=/opt/module/sqoop
export PATH=$PATH:$SQOOP_HOME/bin
使环境生效:
source /etc/profile
2. 修改配置文件
(1)进入conf目录
cd sqoop
cd conf
(2)重命名配置文件sqoop-env-template.s为sqoop-env.sh
mv sqoop-env-template.sh sqoop-env.sh
(3)修改sqoop-env.sh文件
vim sqoop-env.sh
修改6点:
export HADOOP_COMMON_HOME=/opt/module/hadoop-2.7.3
export HADOOP_MAPRED_HOME=/opt/module/hadoop-2.7.3
export HBASE_HOME=/opt/module/hbase
export HIVE_HOME=/opt/module/hive
export ZOOKEEPER_HOME=/opt/module/zookeeper-3.5.7
export ZOOCFGDIR=/opt/module/zookeeper-3.5.7
3. 拷贝JDBC驱动
拷贝到sqoop目录下lib中
sudo cp /opt/software/mysql-connector-java-5.1.48.jar /opt/module/sqoop/lib/
4. 验证Sqoop
bin/sqoop help
会出现警告信息以及帮助命令的出现,说明安好了
5. 测试 Sqoop 是否能够成功连接数据库
bin/sqoop list-databases --connect jdbc:mysql://hadoop102:3306/ --username root --password 666666
成功!!!!!!
|