第一步:开启hadoop /usr/local/hadoop/sbin/start-all.sh --jps查看6个进程
第二步:开启hive hiveserver2 ------hive卡顿,重新开启一个xshell,通过jps查看7个进程
第三步:开启 debeaver客户端,连接hive
第四步:将'student_cs_a1.txt,student_cs_a2.txt,student_ai_b1.txt'这三个文件,从本地拖拽到Ubuntu的根目录下
第五步:在hdfs上创建目录/student ---hdfs dfs -mkdir /student
第六步:上传文件student_cs_a1.txt至hdfs /student目录下 ----hdfs dfs -put /home/hadoop/student_cs_a1.txt /student
第七步:创建分区表
CREATE TABLE IF NOT EXISTS student(
id INT,
name STRING,
age INT,
birthday STRING,
phone INT
)PARTITIONED BY (college STRING, clazz STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ' '
第八步:加载数据 ----load data inpath '/student/student_cs_a1.txt' into table student partition(college ='cs',clazz = 'a1')
第九步:导入本地数据到表student
LOAD DATA local INPATH '/home/hadoop/student_cs_a2.txt' INTO TABLE student PARTITION (college='cs', clazz='a2’);
LOAD DATA local INPATH '/home/hadoop/student_ai_b1.txt' INTO TABLE student PARTITION (college='ai', clazz='b1’);
HIVE分区表执行步骤
最新推荐文章于 2024-11-09 17:03:36 发布