Sqoop 从hive导出mysql

1:查看所有的库

sqoop list-databases \
--connect jdbc:mysql://rm-xxxx.mysql.xxx.xxx.com:3306 \
--username xxxxx \
--password xxxxx


2: 列出库里面所有的表

sqoop list-tables \
--connect jdbc:mysql://xxxxx.xxx.xxx.xxxx.xxx:3306/05_invoxxx \
--username xxxx \
--password xxxxxx 

3: hive导出mysql 

"jdbc:mysql://xxxx.xx.xx.xx:3306/tablename?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&useSSL=false" \
--username xxx --password xxx! \
--table dm_message_info \
--export-dir /user/hive/warehouse/big_data_test.db/dm_message_info/* --input-fields-terminated-by "\\01" \
--update-mode allowinsert \
--update-key service_tenant_id,depart_id,third_tenant_id,status;

--export-dir 导出的hdfs路径 --input-fields-terminated-by 分隔符 \
--update-mode 更新模式 \
--update-key 依照那些组合键进行更新,键存在更新键不存在添加;
 

猜你喜欢

转载自blog.csdn.net/lucklilili/article/details/106624118