全国职业院校技能大赛-大数据应用赛项-采集

1、在主节点使用Flume采集/data_log目录下实时日志文件中的数据,将数据存入到Kafka的Topic中(Topic名称分别为ChangeRecord、ProduceRecord和EnvironmentData,分区数为4),将Flume采集ChangeRecord主题的配置截图粘贴至客户端桌面【Release\任务D提交结果.docx】中对应的任务序号下;

该题采用flume监听实时日志文件中的数据变化,采集到对应的kafka的topic中

首先需要修改kafka的配置,使其能远程访问,配置文件地址:$KAFKA_HOME/config/server.properties

key value 中文含义
listeners PLAINTEXT://0.0.0.0:9092 负责绑定网卡
advertised.listeners PLAINTEXT://your.hostname:9092 负责发布外网地址,这个地址会发布到zookeeper中。
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
# 表示内网所有网卡都绑定9092
listeners=PLAINTEXT://0.0.0.0:9092
 
# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured.  Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
# 表示外网的访问地址,此处应该修改为直连ip
advertised.listeners=PLAINTEXT://your.hostname:9092

可在配置文件中修改默认分区,此配置是在topic生成之前分区的,如果主题已创建,可使用kafka-topics.sh --alter --bootstrap-server bigdata1:9092 --topic xxxx --partitions 4修改分区

num.partitions=4

接下来我们启动实时脚本,如没有运行权限,可用chmod命令设置权限

该脚本每次启动都会生成3个新文件,并向每个文件末尾追加一行数据

==================
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值