数据采集-----案例

1)启动zookeper集群并查看集群状态

三台:

cd /opt/module/zookeeper/

bin/zkServer.sh start

bin/zkServer.sh status

(2)启动Hadoop集群并查看相应的进程

master:start-dfs.sh

slave1:start-yarn.sh

(3)启动kafka集群,并且开启kafka消费者消费指定主题

三台:

cd /opt/module/kafka/

bin/kafka-server-start.sh -daemon config/server.properties

kafka

消费主题

bin/kafka-console-consumer.sh --bootstrap-server=master:9092 --topic=BigData2403

(4)启动efak对kafka集群的监控平台

master:

cd /opt/module/efak/

bin/ke.sh start

(5)启动maxell数据采集工具

master:

cd /opt/module/maxwell/

bin/maxwell --user='maxwell' --password='123456' --host='master' --producer=kafka --kafka.bootstrap.servers=master:9092 --kafka_topic=BigData2403

(6)运行产生业务数据的脚本,向mysql数据库中注入数据,并且观察kafka消费者中消费到的数据。

产生数据

master:

cd /opt/module/db_data/

java -jar gmall2020-mock-db-2021-11-14.jar

(7)启动flume数据采集通道,将数据从kafka集群上的指定主题中采集到HDFS上。

脚本:

#定义组件

a1.sources = r1

a1.channels = c1

a1.sinks = k1

#对source进行配置

a1.sources.r1.type = org.apache.flume.source.kafka.KafkaSource

a1.sources.r1.kafka.bootstrap.servers = master:9092,slave1:9092,slave2:9092

a1.sources.r1.kafka.topics = BigData2403

#添加拦截器的配置对数据进行处理

a1.sources.r1.interceptors=i1

a1.sources.r1.interceptors.i1.type=com.BigData.TableNameInterceptor$Builder

a1.channels.c1.type = file

a1.channels.c1.dataDirs=/opt/module/flume/file/data

a1.channels.c1.checkpointDir=/opt/module/flume/file

a1.sinks.k1.type = hdfs

a1.sinks.k1.hdfs.path = hdfs://master:8020/gmall/db/%{table}/%Y-%m-%d

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

运行flume脚本

cd /opt/module/kafka/

bin/kafka-console-consumer.sh --bootstrap-server=master:9092 --topic=BigData2403

(8)运行Datax采集工具,将HDFS上指定的数据内容到Mysql数。

master:

cd /opt/module/datax/

python bin/datax.py job/mysql_datax_hdfs.json

(9)启动FineBI报表工具,将mysql数据库中的数据进行展示\

master:

cd /opt/FineBI6.0/

bin/finebi

http://master:37799/webroot/decision(若内存太小,无法启动)(解决方法:停掉所有的集群,只启动这个)

相关推荐
新缸中之脑5 小时前
Meta新模型Muse Spark上手体验
大数据·分布式·spark
Thomas21436 小时前
pyspark 新接口 DataSource V2 写法 写入paimon为例
大数据·分布式·spark
howard20051 天前
2.2.3.1 搭建Spark集群
spark·standalone集群
isNotNullX1 天前
数据仓库是什么?怎么搭建数据仓库?
大数据·分布式·spark
AI自动化工坊3 天前
Meta Muse Spark技术深度解析:原生多模态推理架构实践指南
大数据·人工智能·架构·spark
talen_hx2963 天前
《零基础入门Spark》学习笔记 Day 15
大数据·笔记·学习·spark
talen_hx2964 天前
《零基础入门Spark》学习笔记 Day 14
大数据·笔记·学习·spark
xiaoyaohou114 天前
025、分布式计算实战:Spark Core与Spark SQL
sql·ajax·spark
xiaoyaohou114 天前
024、大数据技术栈概览:Hadoop、Spark与Flink
大数据·hadoop·spark
2501_948114244 天前
Muse Spark 闭源转型背后的系统化演进:PAO 架构、KV Cache 压缩与聚合接入实践
大数据·架构·spark