将记录从mysql导出到hdfs中
01ConnectURL=jdbc:mysql://localhost:3306/user_action0203UserName=root0405PassWord=1234560607OutputPath=/hdfs/recommend/user_action/watch_record0809TableName= watch_record1011Columns=id,uid,mid,timestamp121314IfJobCreated =`sqoop job list | grep import_ watch_record`1516#检查import_ watch_record这个job是否已经创建 如果未创建则创建1718if [ $IfJobCreated = ’’ ] then1920sqoop job import_ watch_record /2122 --create --import /2324 --connect $ConnectURL/2526 --username $UserName/2728 --password $PassWord/2930 --target-dir $OutputPath/3132 --m 1/3334 --table $TableName/3536 –columns $Columns/3738 --incremental append/3940 --check-column id/4142 --last-value 04344fi4546 4748sqoop job --exec import_ watch_record
bitsCN.com