sqoop1.4.4 for mysql

软件版本:
hadoop2.2.0(参见 hadoop2.2.0测试环境搭建  )
hbase0.96 (参见 Hbase0.96.0 +hadoop2.2.0安装 )
MySQL5.6.12(参见 mysql5.6.12 for Linux安装 )

实验环境:
hadoop1 192.168.100.171(hadoop master、secondaryname、zookeeper、hbase HMaster)
hadoop2 192.168.100.172(zookeeper、hbase HRegion、Hive Shell)
hadoop3 192.168.100.173(hadoop slave、zookeeper、hbase HRegion)
hadoop4 192.168.100.174(hadoop slave、zookeeper、hbase HRegion)
hadoop5 192.168.100.175(hadoop slave、zookeeper、hbase HRegion)
dataserver 192.168.100.141(Hive metastore、MySQL Server、Oracle)

1:Sqoop安装
[root@dataserver lib]# vi /etc/profile
export HADOOP_COMMON_HOME=/app/hadoop/hadoop220 
#将hadoop220的目录从hadoop1上复制到dataserver的/app/hadoop/hadoop220
export HADOOP_MAPRED_HOME=/app/hadoop/hadoop220
export SQOOP_HOME=/app/hadoop/sqoop144
[root@dataserver lib]# source /etc/profile
[root@dataserver sqoop]# tar zxf sqoop-1.4.4.bin__hadoop-2.0.4-alpha.tar.gz
[root@dataserver sqoop]# mv sqoop-1.4.4.bin__hadoop-2.0.4-alpha /app/hadoop/sqoop144
[root@dataserver sqoop]# chown -R hadoop:hadoop /app/hadoop/sqoop144/
[root@dataserver lib]# su - hadoop
[hadoop@dataserver ~]$ cd /app/hadoop/hive011/lib
[hadoop@dataserver lib]$ cp mysql-connector-java-5.1.26-bin.jar /app/hadoop/sqoop144/lib/
#将mysql的jdbc驱动包复制到lib目录
[hadoop@dataserver lib]$ cd /app/hadoop/sqoop144/

2:Sqoop运行
[hadoop@hadoop1 hadoop220]$ sbin/start-all.sh
sqoop1.4.4 for mysql_第1张图片
 
[hadoop@dataserver sqoop144]$ bin/sqoop import --connect jdbc:mysql://dataserver:3306/wsmall --username hadoop --P --table wsshop_role -m 1
sqoop1.4.4 for mysql_第2张图片

sqoop1.4.4 for mysql_第3张图片
 
[hadoop@hadoop1 hadoop220]$ bin/hdfs dfs -cat  hdfs://hadoop1:8000/user/hadoop/wsshop_role/part-m-00000
sqoop1.4.4 for mysql_第4张图片

你可能感兴趣的:(sqoop1.4.4 for mysql)