考试

作者: 钰独行 | 来源:发表于2023-11-22 23:11 被阅读0次

hostnamectl set-hostname master

hostnamectl set-hostname slave1

hostnamectl set-hostname slave2

172.18.14.238 master

172.18.14.242 slave1

172.18.14.241 slave2

*/30 10-17 * * * /usr/sbin/ntpdate master

master节点

ssh-keygen

ssh-copy-id -i id_rsa.pub master

ssh-copy-id -i id_rsa.pub slave1

ssh-copy-id -i id_rsa.pub slave2

cd /usr/

mkdir java

cd package277

tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/java

cd /usr/java/jdk/

pwd

vim /etc/profile

export JAVA_HOME=/usr/java/jdk1.8.0_221

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=$JAVA_HOME/lib

export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

java -version

-------------------------------

#hadoop

export HADOOP_HOME=/usr/hadoop/hadoop-2.7.7

export CLASSPATH=$CLASSPATH:$HADOOP_HOME/lib

export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

echo master >> master

hostnamectl set-hostname hadoop000 && bash

vim /etc/hosts

添加以下内容

172.18.32.104 hadoop000

注:一个节点都要同时写入一个网址,并且IP为各自分配IP。

ssh-keygen

回车三次

cd /root/.ssh

ssh-copy-id -i id_rsa.pub hadoop000

yes 第一次需要输入密码

ssh hadoop000

ssh localhost

格式化HDFS文件系统

hdfs namenode -format

启动Hadoop集群

start-all.sh

开启mysql服务

systemctl start mysqld

schematool -dbType mysql -initSchema;

hive --service metastore

2、先复制一个master会话窗口,如果要退出:quit;

hive

创建数据库 hive

create database hive;

1.

CREATE  TABLE comm.dim_date ( 

date_id string,

week_id string,

week_day string,

day string,

month string,

quarter string,

year string,

is_workday string,

holiday_id string

)

ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'

LOCATION  '/behavior/dim/dim_date'

TBLPROPERTIES ('skip .header .line .count'= '1');

load data local inpath '/root/bigdata/data/dim_date_2023.txt' into table comm.dim_date;

load data local inpath '/root/bigdata/data/dim_date_2023.txt' overwrite into table comm.dim_date;

2.

create table comm.dim_area

(

city string,

province string,

area string

)

ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'

LOCATION  '/behavior/dim/dim_area';

load data local inpath '/root/bigdata/data/dim_area.txt' overwrite into table comm.dim_area;

3.

create table ads_user_pro

as select province,count(1) cnt

from comm.dws_behavior_log

groupo by province;

insert overwrite local directory '/root/bigdata/result/ads_user_pro'

row format delimited fields terminated by ','

select * from comm.ads_user_pro;

4.

create table ads_user_region

as select b.dt,a.area,count(1) cnt

from comm.dim_area a

comm.dws_behavior_log b

where a.province = b.province

groupo by b.dt,a.area;

insert overwrite local directory '/root/bigdata/result/ads_user_region'

row format delimited fields terminated by ','

select * from comm.ads_user_region;

5.

create table ads_user_hour

as select substring(from_utc_timestamp(ts,'Asia/Shanghai'),12,2) ts_hour,count(1) cnt

from dws_behavior_log

group by substring(from_utc_timestamp(ts,'Asia/Shanghai'),12,2);

insert overwrite local directory '/root/bigdata/result/ads_user_hour'

row format delimited fields terminated by ','

select * from comm.ads_user_hour;

6.

....

7.

create table ads_visit_mode

as select url,device_type,count(1) cnt

from dws_behavior_log

group by url,device_type;

insert overwrite local directory '/root/bigdata/result/ads_visit_mode'

row format delimited fields terminated by ','

select * from comm.ads_visit_mode;

8.

create table ads_online_type

as select url,type,count(1) cnt

from dws_behavior_log

group by url,type;

insert overwrite local directory '/root/bigdata/result/ads_online_type'

row format delimited fields terminated by ','

select * from comm.ads_online_type;

9.

create table ads_user_domain

as select split(url,'.')[1] url_domain,count(1) cnt

from dws_behavior_log

group by split(url,'.')[1],type;

insert overwrite local directory '/root/bigdata/result/ads_user_domain'

row format delimited fields terminated by ','

select * from comm.ads_user_domain ;

相关文章

  • 考试,考试,还是考试

    大概从我们进入小学考试,我们就开启了考试模式了。小学,我们有期中考试和期末考试,不定时还有单元小测验;中学,考试更...

  • 考试!考试!还是考试!

    今天上午第四节课和第三节课,我们班班主任让我们考试,考的是一二单元的,因为我们班班主任教一二单元的时候没有来,所...

  • 考试!考试!

    又是一次看似平常的双休日,但它并不平常,表面上的风平浪静,掩盖不住它的波涛汹涌,不得不说期中考试时直将近了。...

  • 考试,考试

    不知道从什么时候开始,考试的焦虑和随之而来的负面情绪脱离了我的掌控。 苗头也许是在初中的时候,想要考我们那个远城区...

  • 考试,考试

    今天,期末考如期而至。 昨晚,一点才睡。睡前,翻了翻复习资料。全都是字,背的我头晕脑胀。今天,起来翻了翻复习资料,...

  • 考试,考试

    高考结束了,东方小学也公布了学科竞赛的考试分数: 仍然低到惨不忍睹!如之何? 学校明明白白拉扯分数,就是要老师把每...

  • 考试 考试

    梦里,我要去参加一次很重要的考试,可是不知道为什么迟到了。等走到教室,考试已经开始好一会儿了。看看同桌,已...

  • 考试,考试

    参加那么多次考试。第一次看到这么多学生也参加自考。总算看明白学习的意义了,这些学生也是值得鼓励一下的。 哈哈,我呢...

  • 考试!考试!

    从小到大,考过的试也算是“不计其数”了。 小的时候,经常想着长大了之后就轻松了,就不用在考试的时候担惊受怕,害怕老...

  • 考试考试考试

    学位英语怎么破,你们有招没????

网友评论

      本文标题:考试

      本文链接:https://www.haomeiwen.com/subject/sxsyhttx.html