I'm trying to connect Bitnami Certified Kafka AMI with Elastic Beanstalk nodejs environment using kafka-node, how to do that?
After installing apache Kafka locally and testing it with Kafka-node successfully, I wanted to test my app with AWS kafka server.
I configured my AWS Bitnami Certified Kafka AMI listeners to match my Public DNS (IPv4) and exposed the 9092 and 2181 ports in inbound rules. I tested kafka with ssh and it worked perfectly, but when I tried to connect to it with kafka-node it did not work.
listeners=SASL_PLAINTEXT://<Public DNS (IPv4) from AWS>:9092
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
#listeners=PLAINTEXT://<Public DNS (IPv4) from AWS>:9092
# Hostname and port the broker will advertise to producers and consumers.
# If not set it uses the value for "listeners" if configured. Otherwise, it
# will use the value returned from
# java.net.InetAddress.getCanonicalHostName().
advertised.listeners=SASL_PLAINTEXT://<Public DNS (IPv4) from AWS>:9092
# root directory for all kafka znodes.
zookeeper.connect=<Public DNS (IPv4) from AWS>:2181
I'm setting my producer using kafka-node like this:
var Producer = kafka.Producer,
client = new kafka.KafkaClient({ kafkaHost: <kafka-public-ip>:9092}),
producer = new Producer(client);
producer.on('ready', function () {
console.log('Producer is ready');
});
producer.on('error', function (err) {
console.log('Producer is in error state');
console.log(err);
})
kafka-node is throwing a timeout error Error: Unable to find available brokers to try
Bitnami Kafka AMI questions in summary:
1- How to configure Bitnami Kafka AMI with AWS to be accessed remotely
from How to connect AWS Bitnami Certified Kafka AMI with Elastic Beanstalk nodejs environment using kafka-node
No comments:
Post a Comment