数据采集-----案例

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(若内存太小,无法启动)(解决方法:停掉所有的集群,只启动这个)

相关推荐
阿里云大数据AI技术7 小时前
阿里云 EMR Daft AI Function:用 DataFrame 表达式搞定大模型调用与多模态向量化
人工智能·spark
BD_Marathon13 小时前
部署Spark
大数据·javascript·spark
Blossom i14 小时前
Python+spark2.0+Hadoop机器学习与大数据实战第十一章:Python Spark的集成开发环境
大数据·hadoop·spark
BD_Marathon16 小时前
开发Spark应用程序
大数据·ajax·spark
用户3610588626122 天前
Spark 核心之广播变量、累加器原理深度剖析
大数据·spark
用户3610588626123 天前
Spark 核心之二次排序、分组取 TopN 优化分析
大数据·spark
头茬韭菜4 天前
Apache Fluss 项目深度分析与技术文档系列计划
flink·spark·realtime·fluss
Gent_倪5 天前
Spark聚合算法:HashAggregate与SortAggregate详解
大数据·spark
用户3610588626126 天前
Spark 核心之任务调度角色划分以及资源调度角色划分详解
大数据·spark
用户3610588626126 天前
Spark 核心之 Stage 并行度划分及优化详解
spark