You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "chander35 (via GitHub)" <gi...@apache.org> on 2023/03/29 09:33:55 UTC

[GitHub] [camel-k] chander35 opened a new issue, #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

chander35 opened a new issue, #4186:
URL: https://github.com/apache/camel-k/issues/4186

   I have created a sample camel-k program to produce and another program to consume as mentioned below, after the execution of "kamel run KafkaProducer.java --dev" for producing the message, 
   
   ex:- KafkaProducer.java
   <img width="343" alt="image" src="https://user-images.githubusercontent.com/128601152/228489074-fcf6b74c-3dac-40d6-b13a-a330e563aaf6.png">
   
   "kamel run KafkaConsumer.java --dev" for consuming the message, ****
   
   ex:- KafkaConsumer.java
   <img width="352" alt="image" src="https://user-images.githubusercontent.com/128601152/228489821-391f10da-dd0e-4ec1-b6db-89c3f0241342.png">
   
   but every time iam getting error like this:
   
   " ******* Consumer clientId=consumer-0c981e6e-3fbb-4bbf-9142-9c4f6d6e3254-1, groupId=0c981e6e-3fbb-4bbf-9142-9c4f6d6e3254] Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected←[39m←[38;5;203m←[39m←[38;5;227m" @producer
   and 
   "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."@consumer
   
   even though i have added below mentioed commands in application.properties, iam not able to consume messages.
   
   camel.component.kafka.brokers=localhost:9092
   listeners=PLAINTEXT://localhost:9092
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1491436838

   > Here iam using kubernetes inside docker not openshift or minikube, i haven't created any other nodes just working on docker-desktop node only.
   I think what you need is to understand how the connectivity between those components work. We have a simple guide illustrating how to install Camel K on Docker Desktop [1]. However, any connectivity problem is something we cannot help with. I suggest you to figure it out which is the internal IP exposed by your Kafka and see if that IP is reachable by the Camel K docker container. Once that is set it up, then, the Integration will work as expected.
   
   [1] https://camel.apache.org/camel-k/next/installation/platform/docker-desktop.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] lfabriko commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "lfabriko (via GitHub)" <gi...@apache.org>.
lfabriko commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1491427848

   I would suggest `$ kubectl get kafka` which should show you the name of your cluster (name of mine is `my-kafka-cluster`), and then search for bootstrapServer via `$ kubectl get kafka/<name-of-your-kafka-cluster> -o json`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] chander35 commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "chander35 (via GitHub)" <gi...@apache.org>.
chander35 commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1495327395

   > I would suggest `$ kubectl get kafka` which should show you the name of your cluster (name of mine is `my-kafka-cluster`), and then search for bootstrapServer via `$ kubectl get kafka/<name-of-your-kafka-cluster> -o json`
   
   I tried to execute these commands but no use, it is giving nothing related to kafka, Here i have only one pod that is "camel-k-operator-9********-*****", only one node that is "docker-desktop" and i have created namespace with the name "camel-basic" and i made it as default, i have installed kafka, registry and camel-k within the same namespace, but i am not able to get results for your commands. please let me know what else i forgot to do. and my problem is still there not yet fixed. 
   <img width="521" alt="image" src="https://user-images.githubusercontent.com/128601152/229685678-cbdb7e7a-91eb-4c7a-96d0-9229bd2d7325.png">
   
   I approached different way to check if my producer is working or not , i created consumer for the same topic that iam producing messages by using cmd (ex: 
   ![image](https://user-images.githubusercontent.com/128601152/229686215-8baed666-38df-4a3c-8e6d-ff02ee22ef3a.png)) and i tried to produce but i got nothing at consumer side, so it confirmed that it is not even producing anything.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez closed issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez closed issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."
URL: https://github.com/apache/camel-k/issues/4186


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] chander35 commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "chander35 (via GitHub)" <gi...@apache.org>.
chander35 commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1501631117

   Hi Team, the problem is resolved as i replaced the "**localhost**" with my system **IP address**. As soon as i did the changes the code started produce and consume.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1488574869

   I doubt you have a Kafka installed on the same Pod. If you're using `localhost`, it will look for a service in the same `Pod` where the application is running. You need a Kafka server running and a known ip where to connect. Feel free to follow the example we have in https://github.com/apache/camel-k-examples/tree/main/generic-examples/kafka.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] lfabriko commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "lfabriko (via GitHub)" <gi...@apache.org>.
lfabriko commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1488816404

   I think you can check `brokers` parameter if you have installed kafka (e.g. `my-kafka-cluster`) via 
   ```
   $ oc get kafka/my-kafka-cluster -o jsonpath="{.status.listeners[0].bootstrapServers}"
   my-kafka-cluster-kafka-bootstrap.lfabriko3.svc:9092
   ```
   
   Then I have in `KafkaProducer` (similarly in `KafkaConsumer`):
   `.to("kafka:myRecords?brokers=my-kafka-cluster-kafka-bootstrap.lfabriko3.svc:9092");` (or shortly `.to("kafka:myRecords?brokers=my-kafka-cluster-kafka-bootstrap:9092");`)
   
   (I suppose `myRecords` is the created kafka topic)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] heiko-braun commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "heiko-braun (via GitHub)" <gi...@apache.org>.
heiko-braun commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1491407069

   Hi @chander35, which way to setup the docker networking did you follow? https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] chander35 commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "chander35 (via GitHub)" <gi...@apache.org>.
chander35 commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1491261477

   I have installed kafka using yaml file and here i mentioned the yaml file that iam using for creating kafka inside docker
   <img width="690" alt="image" src="https://user-images.githubusercontent.com/128601152/229019886-ca88c2f5-940d-4b91-8974-53c989ccbfac.png">
   and i can see the kafka created and running inside docker,
   <img width="648" alt="image" src="https://user-images.githubusercontent.com/128601152/229020455-bb104874-5745-49a0-87c6-0a83fd0a5bc3.png">
   Here iam using kubernetes inside docker not openshift or minikube, i haven't created any other nodes just working on docker-desktop node only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-k] squakez commented on issue #4186: Unable to produce and consume in camel-k to apache kafka, getting error like "Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available."

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #4186:
URL: https://github.com/apache/camel-k/issues/4186#issuecomment-1501638636

   > Hi Team, the problem is resolved as i replaced the "**localhost**" with my system **IP address**. As soon as i did the changes the code started produce and consume.
   
   Glad to know that! Feel free to close the issue if this is now solved, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org