我正在测试twitter的spring云流应用程序,启动了docker容器,其中包含以下与kafka相关的环境属性,
KAFKA_ADVERTISED_HOST_NAME=<ip>
advertised.host.name=<ip>:9092
spring.cloud.stream.bindings.output.destination=twitter-source-test
spring.cloud.stream.kafka.binder.brokers=<ip>:9092
spring.cloud.stream.kafka.binder.zkNodes=<ip>:2181
我的kafka producerconfig价值观如下:,
2017-01-12 14:47:09.979 INFO 1 --- [itterSource-1-1] o.a.k.clients.producer.ProducerConfig : ProducerConfig values:
compression.type = none
metric.reporters = []
metadata.max.age.ms = 300000
metadata.fetch.timeout.ms = 60000
reconnect.backoff.ms = 50
sasl.kerberos.ticket.renew.window.factor = 0.8
bootstrap.servers = [192.168.127.188:9092]
retry.backoff.ms = 100
sasl.kerberos.kinit.cmd = /usr/bin/kinit
buffer.memory = 33554432
timeout.ms = 30000
key.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
ssl.keystore.type = JKS
ssl.trustmanager.algorithm = PKIX
block.on.buffer.full = false
ssl.key.password = null
max.block.ms = 60000
sasl.kerberos.min.time.before.relogin = 60000
connections.max.idle.ms = 540000
ssl.truststore.password = null
max.in.flight.requests.per.connection = 5
metrics.num.samples = 2
client.id =
ssl.endpoint.identification.algorithm = null
ssl.protocol = TLS
request.timeout.ms = 30000
ssl.provider = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
acks = 1
batch.size = 16384
ssl.keystore.location = null
receive.buffer.bytes = 32768
ssl.cipher.suites = null
ssl.truststore.type = JKS
security.protocol = PLAINTEXT
retries = 0
max.request.size = 1048576
value.serializer = class org.apache.kafka.common.serialization.ByteArraySerializer
ssl.truststore.location = null
ssl.keystore.password = null
ssl.keymanager.algorithm = SunX509
metrics.sample.window.ms = 30000
partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
send.buffer.bytes = 131072
linger.ms = 0
2017-01-12 14:47:09.985信息1---[ittersource-1-1]o.a.kafka.common.utils.appinfoparser:kafka版本:0.9.0.1
但制作者不断抛出以下异常,
2017-01-12 14:47:42.196 ERROR 1 --- [ad | producer-3] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='null' and payload='{-1, 1, 11, 99, 111, 110, 116, 101, 110, 116, 84, 121, 112, 101, 0, 0, 0, 12, 34, 116, 101, 120, 116...' to topic twitter-source-test:
org.apache.kafka.common.errors.TimeoutException: Batch Expired
我可以从docker容器远程登录到broker 192.168.127.188:9092和2181。另外,我的kafka服务器不是docker容器。
看到了一些解决方案,比如添加'adverted.host.name',但不起作用,或者这是我给出env道具的正确方式。
有什么帮助吗?
1条答案
按热度按时间tsm1rwdh1#
共享修复程序。
在server.properties中设置侦听器可以解决此问题。如:
listeners = PLAINTEXT://your.host.name:9092