I am working on a scenario where my kafka producer code will reside on a windows machine & my kafka borker is kerberized in a unix machine. Both of the machines are within the same domain. The firewall ports are open between windows & unix machine.
Need help in getting to know how to proceed on this problem.
I went through following questions:
How to Access kafka brokers secured by kerberos from Eclispe running on windows 7
Connect to Kafka on Unix from Windows with Kerberos
However, none of them have been concluded successfully.
Related
I installed kafka on windows subsystem linux and started using the command confluent local services start and all services are up. Now, when I'm trying to run my kafka-spring application from windows, it is showing the following error:- connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
My server.properties are:-
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://localhost:9092
Where I'm going wrong???
You need to run the Spring app within WSL2 session such that it's on the same network bridge as the hypervisor
Able to connect successfully to local kafka broker/cluster running locally (dockerized) using Conduktor, but when trying to connect to Kafka cluster running on Unix VM, getting below error.
Error:
"The broker [...] is reachable but Kafka can't connect. Ensure you have access to the advertised listeners of the the brokers and the proper authorization"
Appreciate any assistance.
running locally (dockerized)
When running in docker, you need to ensure that the ports are accessible from outside of your container. To verify this, try doing a telnet <ip> <port> and check if you are able to connect.
Since the error message says, the broker is reachable, I suppose you would be able to successfully telnet to the broker.
Next, check your broker config called advertised.listeners. Here you need to mention your IP:Port combination where IP is what you will be giving in your client program i.e. Conduktor.
An example for that would be
advertised.listeners=PLAINTEXT://1.2.3.4:9092
and then restart your broker and reconnect. If you are using ssl then you need to provide some extra configuration. See Configuring Kafka brokers for more.
Try to add in /etc/hosts (Unix-like) or C:\Windows\System32\drivers\etc\hosts (windows-like) the Kafka server in such manner kafka_server_ip kafka_server_name_in_dns (e.g. 10.10.0.1 kafka).
I'm running zookeeper, kafka servers along with a consumer client on a windows machine. When I use a simple producer program in python or c++ in a different machine also running windows, everything works normal. However, when I use the same producer program in a linux machine it does not work, it accuses failed to resolve . All computers are connected on the same network. I have tried to set the listeners and advertised.listeners in the kafka server.properties in several different manners, but with the same result.
Machine running windows with servers and consumer:
IP:192.168.0.149
hostname:something
second Machine running linux or windows (dual boot) with the producer program:
IP:192.168.0.150
hostame:somethingelse
some tried configurations at server.properties:
1
listeners=PLAINTEXT:\0.0.0.0:9092
advertised.listeners=PLAINTEXT:\something:9092
producer at second machine:
producer = KafkaProducer(bootstrap_servers=['192.168.0.149:9092'])
works on windows, does no work on linux
2
listeners=PLAINTEXT:\localhost:9092
advertised.listeners=PLAINTEXT:\something:9092
producer at second machine:
producer = KafkaProducer(bootstrap_servers=['192.168.0.149:9092'])
works on windows, does no work on linux
3
#listeners=
#advertised.listeners=
producer at second machine:
producer = KafkaProducer(bootstrap_servers=['192.168.0.149:9092'])
works on windows, does no work on linux
4
listeners=PLAINTEXT:\192.168.0.149:9092
advertised.listeners=PLAINTEXT:\something:9092
producer at second machine:
producer = KafkaProducer(bootstrap_servers=['192.168.0.149:9092'])
works on windows if consumer passes the ip instead of localhost, does no work on linux
Listeners should always stay as 0.0.0.0. This is the bind address to accept all external connections
If you want to run Kafka on windows, you need to deal with the windows firewall. Try disabling it while testing connections. It would probably be best that you switch the broker to run on Linux.
The advertised listeners should only be the hostname if both systems are able to resolve each other by DNS name. Otherwise, save yourself the extra network hop and use the IP as the advertised listener. If you're getting "failed to resolve", seems like a DNS issue, and ping windows-host shouldn't work either
To debug your connection, I would suggest using kafkacat
kafkacat -b kafka-host:9092 -L
I have Hortonworks DataFlow (HDF3.0.2) running in VmWare on my mac. Kafka broker is running on port 6667 and the IP address of sandbox is 172.17.0.2
In java program, running locally on my mac, I have bootstrap server configured as below:
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "172.17.0.2:6667");
Java program just hangs cannot produce message in kafka topic. I have tried disabling the firewall, added entry in /etc/hosts as:
172.17.0.2 sandbox-hdf.hortonworks.com
and changed the bootstrap servers config entry to use sandbox-hdf.hortonworks.com, but no luck.
telnet command to 172.17.0.2 6667 hangs as well and it gives connection timeout error.
Any help to produce message in Kafka running in HDF 3.0.2 from outside of Vmware is highly appreciated. Please let me know if I am missing anything.
Thanks for your time and help.
I'm not able to access kafka which is in remote server from my local server.
I tried to set parameter advertised.listeners=PLAINTEXT://ip:port in server.properties of kafka where ip is the public ip of my remote machine where kafka is. But still I'm not able to connect. What should I need to do next? I'm using confluent kafka of version 3.3.0.