赞
踩
注意!如果重置了代码仓库请用以下步骤:
- start-all.sh
-
- schematool -dbType mysql -initSchema
-
- 重置之后mysql数据库里数据没了,所以重新输入就行。
-
- mysql -uroot -p123123 -h127.0.0.1
-
- create database hdfsdb;
-
- use hdfsdb;
-
- create table student(stu_no int primary key, stu_name varchar(20), stu_age int);
-
- insert into student values(202001,"zhangsan",18);
-
- insert into student values(202002,"lisi",19);
-
- insert into student values(202003,"wangwu",20);
-
- exit;
-
- hive
-
- create table test2(stu_no int,stu_name string,stu_age int)
-
- row format delimited
-
- fields terminated by ",";
-
- exit;
-
- sqoop import --connect jdbc:mysql://127.0.0.1:3306/hdfsdb --username root --password 123123 --query 'select stu_no, stu_name,stu_age from student where stu_age>=20 and $CONDITIONS' --target-dir /user/root/hdfsdb6 --fields-terminated-by ',' -m 1
-
- hive
-
- load data inpath '/user/root/hdfsdb6/part-m-00000' into table test2;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。