概述
安装准备:在安装Sqoop前,我已经事先已经安装好了,java jdk,hadoop,zookeeper,hive,hbase,安装目录在/opt/soft/ 目录下,并且,已经将sqoop的安装和mysql的jar包置于/opt/install目录下,soft和install目录都是自己创建的(mkdir -p /opt/soft;mkdir -p /opt/install)
sqoop安装包版本:sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz
mysql的版本: mysql-connector-java-5.1.25.jar
安装及配置步骤:
第一步,解压并重命名sqoop的解压包
tar -zxf /opt/intall/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /opt/soft/
mv /opt/soft/sqoop-1.4.6.bin__hadoop-2.0.4-alpha /opt/softsqoop146
第二步,配置sqoop解压包中conf的文件sqoop-env.sh
配置前需要先重命名sqoop-env-template.sh文件
mv /opt/soft/sqoop146/conf/sqoop-env-template.sh /opt/soft/sqoop146/conf/sqoop-env.sh
打开文件,配置内容如下 vi /opt/soft/sqoop146/conf/sqoop-env.sh,
#hadoop的安装目录
export HADOOP_COMMON_HOME=/opt/soft/hadoop260
export HADOOP_MAPRED_HOME=/opt/soft/hadoop260
#hbase的安装目录
export HBASE_HOME=/opt/soft/hbase120
#hive的安装目录
export HIVE_HOME=/opt/soft/hive110
#zookeeper的配置文件目录
export ZOOCFGDIR=/opt/soft/zookeeper345/conf
第三步,将mysql的jar包拷贝到sqoop解压包lib目录下
cp /opt/install/mysql-connector-java-5.1.25.jar /opt/soft/sqoop146/lib/
第四步,配置/etc/profile文件,在末尾加入
#sqoop
export SQOOP_HOME=/opt/soft/sqoop146
export PATH=$PATH:$SQOOP_HOME/bin
保存退出后
source /etc/profile
第五步,验证
先开启hadoop,zookeeper,成功开启后再输入sqoop version,验证是否成功安装配置sqoop
如下图,则成功了
自动安装脚本内容如下:
#!/bin/bash
#sqoop
sqoop=true
if [ `$sqoop`=true ]; then
echo '------------sqoop安装中-------------'
tar -zxf /opt/install/sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /opt/soft/
mv /opt/soft/sqoop-1.4.6.bin__hadoop-2.0.4-alpha /opt/soft/sqoop146
mv /opt/soft/sqoop146/conf/sqoop-env-template.sh /opt/soft/sqoop146/conf/sqoop-env.sh
sqoop_env_path=/opt/soft/sqoop146/conf/sqoop-env.sh
sed -i "/^#export HADOOP_COMMON_HOME=/cexport HADOOP_COMMON_HOME=/opt/soft/hadoop260/" $sqoop_env_path
sed -i "/^#export HADOOP_MAPRED_HOME=/cexport HADOOP_MAPRED_HOME=/opt/soft/hadoop260/" $sqoop_env_path
sed -i "/^#export HBASE_HOME=/cexport HBASE_HOME=/opt/soft/hbase120/" $sqoop_env_path
sed -i "/^#export HIVE_HOME=/cexport HIVE_HOME=/opt/soft/hive110/" $sqoop_env_path
sed -i "/^#export ZOOCFGDIR=/cexport ZOOCFGDIR=/opt/soft/zookeeper345/conf/" $sqoop_env_path
cp /opt/install/mysql-connector-java-5.1.25.jar /opt/soft/sqoop146/lib/
echo '#sqoop' >>/etc/profile
echo 'export SQOOP_HOME=/opt/soft/sqoop146' >>/etc/profile
echo 'export PATH=$PATH:$SQOOP_HOME/bin' >>/etc/profile
source /etc/profile
echo '------------sqoop安装完毕-------------'
fi
最后
以上就是魁梧帅哥为你收集整理的linux虚拟机下,Sqoop的安装与配置的全部内容,希望文章能够帮你解决linux虚拟机下,Sqoop的安装与配置所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复