一、安装hadoop
二、安装hive
三、上面是安装hadoop集群和hive的方法
四、执行任务
4.1、创建数据库
4.2、创建表
4.3、导入数据
4.4、执行统计任务
select count(*) from student;
4.5、执行完成后
hive> select count(*) from student;
Query ID = root_20231112015526_db2d3c2d-0892-4ed0-a1cc-fae1e66fd0b0
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
set mapreduce.job.reduces=<number>
Starting Job = job_1699725018325_0002, Tracking URL = http://node1:8088/proxy/application_1699725018325_0002/
Kill Command = /usr/local/bigdata/hadoop-3.3.6/bin/mapred job -kill job_1699725018325_0002
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
2023-11-12 01:55:43,358 Stage-1 map = 0%, reduce = 0%
2023-11-12 01:55:50,508 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 1.86 sec
2023-11-12 01:55:58,663 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 4.4 sec
MapReduce Total cumulative CPU time: 4 seconds 400 msec
Ended Job = job_1699725018325_0002
MapReduce Jobs Launched:
Stage-Stage-1: Map: 1 Reduce: 1 Cumulative CPU: 4.4 sec HDFS Read: 30204 HDFS Write: 104 SUCCESS
Total MapReduce CPU Time Spent: 4 seconds 400 msec
OK
1263
Time taken: 32.947 seconds, Fetched: 1 row(s)
4.6、hadoop查看任务
这样就可以看到在hadoop上执行的任务了