05-用户画像+mysql-hive数据导入

将用户数据导入数仓

新建 create_hive_table.sh文件

在终端执行以下文件

sh create_hive_table.sh

sql 复制代码
sqoop create-hive-table \
--connect jdbc:mysql://up01:3306/tags_dat \    tags_dat库名
--username root \       root 用户名
--password 123456 \    123456  密码
--table tbl_users \     tbl_users表名
--hive-database db_ods  \    db_ods  hive数据库库名
--hive-table tbl_users      tbl_users  表名

wait

sqoop create-hive-table \
--connect jdbc:mysql://up01:3306/tags_dat \
--username root \
--password 123456 \
--table tbl_goods \
--hive-database db_ods  \
--hive-table tbl_goods

wait

sqoop create-hive-table \
--connect jdbc:mysql://up01:3306/tags_dat \
--username root \
--password 123456 \
--table tbl_logs \
--hive-database db_ods  \
--hive-table tbl_logs

wait

sqoop create-hive-table \
--connect jdbc:mysql://up01:3306/tags_dat \
--username root \
--password 123456 \
--table tbl_orders \
--hive-database db_ods  \
--hive-table tbl_orders

导入脚本

sql 复制代码
 sqoop import \
 --connect jdbc:mysql://up01:3306/tags_dat \
 --username root \
 --password 123456 \
 --table tbl_users \
 --hive-import \
 --hive-overwrite \
 --hive-database db_ods  \
 --hive-table tbl_users \
 --delete-target-dir \
 -m 2

 wait

sqoop import \
 --connect jdbc:mysql://up01:3306/tags_dat \
 --username root \
 --password 123456 \
 --table tbl_goods \
 --hive-import \
 --hive-overwrite \
 --hive-database db_ods  \
 --hive-table tbl_goods \
 --delete-target-dir \
 -m 2

wait

sqoop import \
 --connect jdbc:mysql://up01:3306/tags_dat \
 --username root \
 --password 123456 \
 --table tbl_logs \
 --hive-import \
 --hive-overwrite \
 --hive-database db_ods  \
 --hive-table tbl_logs \
 --delete-target-dir \
 -m 2

wait

sqoop import \
 --connect jdbc:mysql://up01:3306/tags_dat \
 --username root \
 --password 123456 \
 --table tbl_orders \
 --hive-import \
 --hive-overwrite \
 --hive-database db_ods  \
 --hive-table tbl_orders \
 --delete-target-dir \
 -m 2
相关推荐
萧鼎7 分钟前
深度探索 Py2neo:用 Python 玩转图数据库 Neo4j
数据库·python·neo4j
用户Taobaoapi201431 分钟前
母婴用品社媒种草效果量化:淘宝详情API+私域转化追踪案例
大数据·数据挖掘·数据分析
m0_653031361 小时前
腾讯云认证考试报名 - TDSQL数据库交付运维专家(TCCE MySQL版)
运维·数据库·腾讯云
power 雀儿1 小时前
集群聊天服务器---MySQL数据库的建立
服务器·数据库·mysql
G皮T1 小时前
【Elasticsearch】检索排序 & 分页
大数据·elasticsearch·搜索引擎·排序·分页·检索·深度分页
zhuyasen2 小时前
定义即代码!这个框架解决了90%的Go开发者还在低效开发项目的问题
架构·go·gin
LCG元2 小时前
云原生微服务间的异步消息通信:最终一致性与系统容错的架构实战
微服务·云原生·架构
骑着王八撵玉兔3 小时前
【性能优化与架构调优(二)】高性能数据库设计与优化
数据库·性能优化·架构
无级程序员3 小时前
hive2服务启动报错:/tmp/hive on HDFS should be writable(不是chmod 777能解决的)
hive·hadoop·hdfs
想要入门的程序猿4 小时前
Qt写入excel
数据库·qt·excel