Sqoop
vim /etc/profile
export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0/
export PATH=$JAVA_HOME/bin:$PATH
hadoop-2.10.0
#hadoop
export HADOOP_HOME=/opt/modules/hadoop-2.10.0
export PATH=$PATH:$HADOOP_HOME/bin
hbase-1.2.8
hive-2.3.6
#hive
export HIVE_HOME=/opt/modules/hive-2.3.6
export HIVE_CONF_DIR=/opt/modules/hive-2.3.6/conf
export PATH=$PATH:$HIVE_HOME/bin
sqoop-1.4.7
#sqoop
export SQOOP_HOME=/opt/modules/sqoop-1.4.7
export PATH=$PATH:$SQOOP_HOME/bin
mv sqoop-1.4.7/conf/sqoop-env-template.sh sqoop-1.4.7/conf/sqoop-env.sh
vim sqoop-1.4.7/conf/sqoop-env.sh
#Set path to where bin/hadoop is available
export HADOOP_COMMON_HOME=/opt/modules/hadoop-2.10.0
#Set path to where hadoop-*-core.jar is available
export HADOOP_MAPRED_HOME=/opt/modules/hadoop-2.10.0
#set the path to where bin/hbase is available
export HBASE_HOME=/opt/modules/hbase-1.2.8
#Set the path to where bin/hive is available
export HIVE_HOME=/opt/modules/hive-2.3.6
#Set the path for where zookeper config dir is
export ZOOCFGDIR=/opt/modules/zookeeper-3.4.6/conf
zookeeper-3.4.6
#zookeeper
export ZOOKEEPER_HOME=/opt/modules/zookeeper-3.4.6
sqoop version
cd ../lib/
cp ../../hive-2.3.6/lib/mysql-connector-java-5.1.46.jar ./
sqoop list-databases --connect jdbc:mysql://192.168.0.189:3306/ --username root
sqoop list-tables --connect jdbc:mysql://192.168.0.189:3306/hive --username hive --password hive
sqoop create-hive-table --connect jdbc:mysql://192.168.0.189:3306/hive --username hive --passowrd hive --table WRITE_SET --hive-table WS
导入mysql库中的help_keyword的数据到HDFS上
sqoop import --connect jdbc:mysql://192.168.0.189:3306/hive --username hive --password hive --table help_keyword -m 1
把MySQL数据库中的表数据导入到Hive中
sqoop import --connect jdbc:mysql://192.168.0.189:3306/hive --username hive --password hive --table help_keyword --hive-import -m 1