Comments (17)
Ah, the brackets in [localhost]:9092
probably means it is an IPv6 address, i.e., that your localhost
entry resolves to both an IPv4 and IPv6 address (usually ip6-localhost
is used for the IPv6 address).
And if the broker is only listening on the IPv4 port this will fail when rdkafka attempts to connect to the IPv6 address, on the next connection attempt it will use the next address which is IPv4 (roundrobin).
Can you double check if that is the case? E.g., grep localhost /etc/hosts
or host localhost
.
Mine gives:
$ host localhost
localhost has address 127.0.0.1
localhost has IPv6 address ::1
from kcat.
I'm guessing your broker only listens to the IPv4 port, not IPv6, but its advertised host entry resolves to an IPv6 address (or both IPv6 and IPv4 in which case the addresses will be roundrobined).
You can verify which address family the broker is listening to with these commands:
Check for IPv4 broker bind: netstat -anp -A inet | grep :9092
Check fopr IPv6 broker bind: netstat -anp -A inet6 | grep :9092
(thats on Linux)
from kcat.
Is there a broker running on localhost:9092?
What -b ..
arguments are you giving to kafkacat?
from kcat.
below is exact arguments and output I got.
Kafka broker is indeed running at localhost:9092 because the consumer showed the output properly which was given after the messages below.
$ kafkacat -P -b localhost:9092 -t test -p 0
%3|1418300191.571|FAIL|rdkafka#producer-0| localhost:9092/bootstrap: Failed to connect to broker at [localhost]:9092: Connection refused
%3|1418300191.571|ERROR|rdkafka#producer-0| localhost:9092/bootstrap: Failed to connect to broker at [localhost]:9092: Connection refused
%3|1418300191.571|ERROR|rdkafka#producer-0| 1/1 brokers are down
from kcat.
Thanks @edenhill this was indeed the issue. Great job debugging the issue friend.
Guess you could document this in the wiki somewhere.
from kcat.
Hi there, having the same problem, but running examples of librdkafka. Same output of the mentioned grep localhost /etc/hosts
. I didn't understand the solution, pardon.
My command has switched from
./rdkafka_example -P -t test -b localhost:9092
to
./rdkafka_example -P -t test -b ::1:9092
just obtaining the change from
Failed to connect to broker at localhost:9092: Connection refused
to
Failed to connect to broker at [::0.1.144.146]:9092: Network is unreachable
What am I doing wrong ? Thanks.
from kcat.
If this turns out to be the problem you can limit what address families librdkafka will try to connect to with the broker.address.family
configuration property (set to v4
or v6
, defaults to any
)
from kcat.
Well, this is embarassing. Kafka just wasn't installed neither running. I apologize for this waste of time 😆
from kcat.
He, no worries :)
from kcat.
Hi, i new in kafka, after I installed librdkafka, then run an example file, i have the same issue. When using rdkafka_example_cpp to set up producer:
rdkafka_example_cpp -P -t my_topic -p 1 -b 127.0.0.1:9092
i got these outputs:
% Created producer rdkafka#producer-0
LOG-3-FAIL: 127.0.0.1:9091/bootstrap: Failed to connect to broker at new-host:9091: Connection refused
and when using rdkafka_example_cpp to set up consumer:
rdkafka_example_cpp -C -t my_topic -p 3 -b 127.0.0.1:9093
a got this these outputs :
% Created consumer rdkafka#consumer-0
LOG-3-FAIL: 127.0.0.1:9093/bootstrap: Failed to connect to broker at new-host:9093: Connection refused
ERROR (Local: Broker transport failure): 127.0.0.1:9093/bootstrap: Failed to connect to broker at new-host:9093: Connection refused
ERROR (Local: All broker connections are down): 1/1 brokers are down
I've checked the IP version used, and I think the problem is not there.is there any suggestion, what's wrong with above command?
from kcat.
Connection refused means librdkafka can't TCP connect to a given broker.
One of your brokers advertises itself as new-host:9093
, but there is no broker running on that host+port, or it is firewalled.
Check your connectivity (you can use telnet new-host 9093
from the host kafkacat runs on to see if you have connectivity.
from kcat.
Hi! I am having the same issue when trying to run the solution given in https://stackoverflow.com/questions/35619980/how-to-accept-twitter-stream-using-tweepy-in-streamparse-spout-and-pass-the-twee. An error is cropping up stating:
Failed to connect newly created broker for 127.0.0.1:9092
Socket disconnected during metadata request for broker 127.0.0.1:9092. Continuing.
When I ran "grep localhost /etc/hosts" on terminal as per above suggestion, the following response was received:
127.0.0.1 localhost
::1 ip6-localhost ip6-loopback
Hence localhost is configured correctly. Am I correct? If so, what would think would be the issue please? Sorry I am a little new to Storm and Kafka (and I am still getting more familiar with Python and Ubuntu).
I thank you in advance for your help and support.
from kcat.
@scamosa Not really sure what that has to do with kafkacat, there is no mention of it.
from kcat.
I have a main Python method with the following code:
from listener import MyStreamListener MyStreamListener()
Inside listener.py you will find:
import tweepy
from streamparse.spout import Spout
from pykafka import KafkaClient
class TweetSpout(Spout):
words = []
def initialize(self, stormconf, context):
client = KafkaClient(hosts='127.0.0.1:9092')
self.topic = client.topics[str('tweets')]
def next_tuple(self):
consumer = self.topic.get_simple_consumer()
for message in consumer:
if message is not None:
self.emit([message.value])
else:
self.emit()
class MyStreamListener(tweepy.StreamListener):
def on_status(self, status):
# print(status.text)
client = KafkaClient(hosts='127.0.0.1:9092')
topic = client.topics[str('tweets')]
with topic.get_producer(delivery_reports=False) as producer:
# print status.text
sentence = status.text
for word in sentence.split(" "):
if word is None:
continue
try:
word = str(word)
producer.produce(word)
except:
continue
def on_error(self, status_code):
if status_code == 420: # exceed rate limit
return False
else:
print("Failing with status code " + str(status_code))
return False
auth = tweepy.OAuthHandler(API_KEY, API_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth=api.auth, listener=myStreamListener)
myStream.filter(track=['is'])
I am getting the following error:
Failed to connect newly created broker for 127.0.0.1:9092 Socket disconnected during metadata request for broker 127.0.0.1:9092. Continuing. Failed to connect newly created broker for 127.0.0.1:9092 Socket disconnected during metadata request for broker 127.0.0.1:9092. Continuing. Failed to connect newly created broker for 127.0.0.1:9092 Socket disconnected during metadata request for broker 127.0.0.1:9092. Continuing.
from kcat.
I'm sorry but what does this have to do with kafkacat?
from kcat.
I googled for a solution and this site cropped up. Given that the same output was given, I thought it might be related. In that case, I am sorry for wasting your time and I thank you for looking into my problem. Hope will find a solution.
from kcat.
Hi everyone!
1. Docker Desktop on Windows
2. There are commands for up kafka , zookeeper, kafka-manager:
- docker run -d --name kafkadocker_zookeeper_1 dockerkafka/zookeeper
- docker run -d --name kafkadocker_kafka_1 --link kafkadocker_zookeeper_1:zookeeper dockerkafka/kafka
- docker run -d -it --rm --link kafkadocker_zookeeper_1:zookeeper --link kafkadocker_kafka_1:kafka -p 9000:9000 -e ZK_HOSTS=zookeeper:2181 dockerkafka/kafka-manager
3. Containers
4. Kafka - manager: cluster name is test, the topic name is test-topic
5. Confluent's .NET Client for Apache Kafka. Link: https://github.com/confluentinc/confluent-kafka-dotnet
5.1 Producer
5.2 Visual Studio Console
Can you help me solve this problem?
If there are any answers write to me in gmail: [email protected]
Thank you all !!! 💯
from kcat.
Related Issues (20)
- sasl.mechanisms=SCRAM-SHA-512 not taken in account HOT 1
- Build failed for windows 11
- How to create a topic with a specific number of partitions
- bootstrap.sh fails HOT 1
- Single-object encoding deserializer HOT 1
- Kcat with SSL fails HOT 1
- feature request: add `-v` and `--version` flags HOT 3
- logical type support in avro format
- Having bootstrap.servers configured in ~/.config/kcat.conf causes errors output with mock cluster
- Kafkacat would read less records than expected
- Is this project alive or abandoned? HOT 3
- kcat built under Windows does not support the High-level KafkaConsumer mode
- Publish 1.7 for apt HOT 1
- Feature Request: Include version info in the binary file properties, at least for Windows builds.
- bvn13/kat repository not available for Fedora 38
- "-e" doesnt exit as it should. I.e. kafkacat -b kafkahost -o end -e -t mytopic HOT 1
- Hi, same issue...
- support avro
- README typo
- KCAT ignores ssl.ca.location if it's in config file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kcat.