数据采集-----案例

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

相关推荐
极光代码工作室1 天前
基于Spark的日志监控与分析平台
大数据·hadoop·python·spark·数据可视化
Leo.yuan2 天前
数据仓库建设怎么做?从源数据到分析报表全流程讲清
大数据·分布式·spark
OneNobody3 天前
Spark SQL AQE工作原理源码剖析
大数据·sql·spark
humbinal3 天前
同时支持 gui & cli 的 parquet 文件查看工具,高性能小清新!
hive·python·rust·spark·开源·github·parquet
阿里云大数据AI技术3 天前
阿里云 EMR Serverless Spark 全托管 Ray 再进化:加速构建全模态数据处理新基建
人工智能·spark
LitchiCheng3 天前
轻量化微调 Qwen2.5 LoRA 训练全流程详解
大数据·人工智能·spark
董可伦4 天前
Spark 源码 | Yarn Client 模式提交流程(五)
大数据·spark
Gent_倪5 天前
万字详解:数据库、数据仓库、数据湖、湖仓一体
数据库·数据仓库·spark
2501_948106915 天前
计算机毕业设计之jsp-智慧旅游分享平台
java·开发语言·spark·汽车·课程设计·旅游