2.调试kafka源码
发布日期:2021-07-30 03:26:38
浏览次数:3
分类:技术文章
本文共 1626 字,大约阅读时间需要 5 分钟。
1.调试core包
1.日志文件配置
拷贝config/log4j.properties文件到core/src/main/scala下,便于观察日志
修改log4j.properties文件# 此处将info改成了debuglog4j.rootLogger=debug, stdout, kafkaAppender
2.修改config/server.properties文件
broker.id=0#delete.topic.enable=true#listeners=PLAINTEXT://:9092num.network.threads=3num.io.threads=8socket.send.buffer.bytes=102400socket.receive.buffer.bytes=102400socket.request.max.bytes=104857600log.dirs=/tmp/kafka-logsnum.partitions=1offsets.topic.replication.factor=1transaction.state.log.replication.factor=1transaction.state.log.min.isr=1#log.flush.interval.messages=10000#log.flush.interval.ms=1000log.retention.hours=168#log.retention.bytes=1073741824log.segment.bytes=1073741824log.retention.check.interval.ms=300000zookeeper.connect=localhost:2181zookeeper.connection.timeout.ms=6000group.initial.rebalance.delay.ms=0
这里修改如下文件
1. log.dirs=F:\\resources\\kafka\\logs2. zookeeper.connect=localhost:2181# 如果不是本机安装zookeeper,则localhost替换成zookeeper地址3. zookeeper.connection.timeout.ms=60000# 增加了zookeeper连接超时时间配置文件尽可能使用主机名,不使用ip
3.调试配置
-
idea点击Run–Edit Configurations,点击+ 号,选择Application
编辑名称为kafka -
配置运行主类
或者搜索kafka -
配置参数config/server.properties
总配置如下: -
编码格式设置
4.启动
idea出现了刚刚配置的kafka,点击debug图标
报错
Execution failed for task ':core:Kafka.main()'.> Process 'command 'E:/setupall/java8/bin/java.exe'' finished with non-zero exit value 1* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Unable to connect to zookeeper server 'ip:2281' with timeout of 60000 ms
5.访问规则设置
ip为阿里云的服务器公网ip,进入阿里云控制台修改访问规则
点击配置规则 勾选需要添加的端口范围,如全部,点击确定6.再次启动
转载地址:https://blog.csdn.net/u010895512/article/details/118254388 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
感谢大佬
[***.8.128.20]2024年03月29日 02时21分26秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
201312-2_ISBN号码
2019-04-28
201403-1_相反数的个数
2019-04-28
4-31Data Sinks
2019-04-28
pytorch是否可以使用CUDA
2019-04-28
机器学习中Inference 和predict的区别是什么?
2019-04-28
jpg 和 png
2019-04-28
python实现读取并显示图片的方法(PIL)
2019-04-28
estimate()==>从一组对应的点估算变换是否成功
2019-04-28
python __getitem__()方法==>可以直接通过P[key]做运算
2019-04-28
【训练过程】1) Create Training File(创建训练文件)
2019-04-28