我有一个关于使用端口转发发送消息到Kafka的问题。我们对kafka使用如下端口转发:
| Hostname | IP | Port | Port Forwarding |
|----------|---------------|------|-----------------------|
| kafka01 | 192.168.0.100 | 9092 | 106.107.118.119:30124 |
| kafka02 | 192.168.0.101 | 9092 | 106.107.118.119:30125 |
| kafka03 | 192.168.0.102 | 9092 | 106.107.118.119:30126 |
要从本地主机连接到kafka代理,我必须使用vpn连接到这些地址 192.168.0.X:9092
它成功地从我的本地主机(我的笔记本电脑)向Kafka发送了消息。但是当将我的应用程序部署到实际服务器时,它必须使用端口转发来连接到kafka代理,它没有向kafka发送任何消息,并且没有任何错误显示。
从真正的服务器,它仍然可以连接到Kafka经纪人( telnet 106.107.118.119 30124
成功)。我不知道为什么。这是生产者配置:
INFO | jvm 1 | 2017/07/29 16:34:36 | [2017-07-29 04:34:36] INFO -
ProducerConfig values:
INFO | jvm 1 | 2017/07/29 16:34:36 | compression.type = none
INFO | jvm 1 | 2017/07/29 16:34:36 | metric.reporters = []
INFO | jvm 1 | 2017/07/29 16:34:36 | metadata.max.age.ms = 300000
INFO | jvm 1 | 2017/07/29 16:34:36 | metadata.fetch.timeout.ms =
60000
INFO | jvm 1 | 2017/07/29 16:34:36 | acks = 1
INFO | jvm 1 | 2017/07/29 16:34:36 | batch.size = 16384
INFO | jvm 1 | 2017/07/29 16:34:36 | reconnect.backoff.ms = 10
INFO | jvm 1 | 2017/07/29 16:34:36 | bootstrap.servers =
[106.107.118.119:30124, 106.107.118.119:30125, 106.107.118.119:30126]
INFO | jvm 1 | 2017/07/29 16:34:36 | receive.buffer.bytes = 32768
INFO | jvm 1 | 2017/07/29 16:34:36 | retry.backoff.ms = 100
INFO | jvm 1 | 2017/07/29 16:34:36 | buffer.memory = 33554432
INFO | jvm 1 | 2017/07/29 16:34:36 | timeout.ms = 30000
INFO | jvm 1 | 2017/07/29 16:34:36 | key.serializer = class
org.apache.kafka.common.serialization.StringSerializer
INFO | jvm 1 | 2017/07/29 16:34:36 | retries = 0
INFO | jvm 1 | 2017/07/29 16:34:36 | max.request.size = 1048576
INFO | jvm 1 | 2017/07/29 16:34:36 | block.on.buffer.full = true
INFO | jvm 1 | 2017/07/29 16:34:36 | value.serializer = class
org.apache.kafka.common.serialization.StringSerializer
INFO | jvm 1 | 2017/07/29 16:34:36 | metrics.sample.window.ms = 30000
INFO | jvm 1 | 2017/07/29 16:34:36 | send.buffer.bytes = 131072
INFO | jvm 1 | 2017/07/29 16:34:36 |
max.in.flight.requests.per.connection = 5
INFO | jvm 1 | 2017/07/29 16:34:36 | metrics.num.samples = 2
INFO | jvm 1 | 2017/07/29 16:34:36 | linger.ms = 1
INFO | jvm 1 | 2017/07/29 16:34:36 | client.id =
INFO | jvm 1 | 2017/07/29 16:34:36 | - in logAll() at line 113 of
class org.apache.kafka.common.config.AbstractConfig
它不显示任何错误,但当使用简单的Kafka消费应用程序时,Kafka中没有消息,而从我的计算机发送时有消息( bootstrap.servers=[192.168.0.100:9092, 192.168.0.101:9092, 192.168.0.102:9092]
). 有人知道这个问题吗?
暂无答案!
目前还没有任何答案,快来回答吧!