将用户数据导入数仓

新建 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