sngular / kloadgen

KLoadGen is kafka load generator plugin for jmeter designed to work with AVRO, JSON and PROTOL-BUFFERS schema Registries.
http://sngular.com
Mozilla Public License 2.0
209 stars 42 forks source link

[Issue]: JMeter not able to reach docker-compose container by hostname #250

Closed galegofer closed 2 years ago

galegofer commented 2 years ago

What happened?

Not sure, if it is an actual KLoadGen issue, but I have a docker-compose file where I startup all the containers including my Kafka broker and schema-registry.

the hostname for the Kafka container is a broker and it is at port 29092

But I am getting a when executing the test plan:

2022-05-12 15:18:14,068 WARN o.a.k.c.NetworkClient: [Producer clientId=] Error connecting to node broker:29092 (id: 1 rack: null) java.net.UnknownHostException: broker at java.net.InetAddress$CachedAddresses.get(InetAddress.java:797) ~[?:?] at java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[?:?] at java.net.InetAddress.getAllByName(InetAddress.java:1364) ~[?:?] at java.net.InetAddress.getAllByName(InetAddress.java:1298) ~[?:?] at org.apache.kafka.clients.DefaultHostResolver.resolve(DefaultHostResolver.java:27) ~[kloadgen-4.3.0.jar:?] at org.apache.kafka.clients.ClientUtils.resolve(ClientUtils.java:110) ~[kloadgen-4.3.0.jar:?]

When I am trying to access from the browser with broker:29092, it seems to be fine.

docker-compose config:

broker: image: confluentinc/cp-kafka:6.2.0 hostname: broker container_name: broker depends_on:

TestPlan:

`<?xml version="1.0" encoding="UTF-8"?>

false true false continue false 1 1 1 false true bootstrap.servers 127.0.0.1:29092 = zookeeper.servers localhost:2181 = kafka.topic.name create-document = compression.type none = batch.size 16384 = linger.ms 0 = buffer.memory 33554432 = acks 1 = send.buffer.bytes 131072 = receive.buffer.bytes 32768 = security.protocol PLAINTEXT = kerberos.auth.enabled NO = jaas.enabled NO = java.security.auth.login.config <JAAS File Location> = java.security.krb5.conf <krb5.conf location> = sasl.kerberos.service.name kafka = sasl.mechanism GSSAPI = ssl.enabled NO = ssl.key.password <Key Password> = ssl.keystore.location <Keystore Location> = ssl.keystore.password <Keystore Password> = ssl.truststore.location <Truststore Location> = ssl.truststore.password <Truststore Password> = client.id = security.providers = ssl.enabled.protocols TLSv1.2,TLSv1.3 = ssl.endpoint.identification.algorithm https = ssl.keymanager.algorithm SunX509 = ssl.keystore.type JKS = ssl.provider = ssl.protocol TLSv1.3 = auto.register.schemas true = net.coru.kloadgen.sampler.KafkaSchemaSampler schema.registry.auth.enabled NO schema.registry.auth.method BASIC schema.registry.username <username> schema.registry.password <password> schema.registry.bearer <bearer> http://localhost:8081 io.confluent.kafka.serializers.subject.RecordNameStrategy io.confluent.kafka.serializers.KafkaAvroSerializer create-document-value metadata.createTs 0 long_timestamp-millis true true metadata.msgId 0 string true true metadata.sourceApp 0 string true true metadata.tenant 0 string true true metadata.language 0 string true true metadata.sessionId 0 string true true metadata.channel 0 string true true metadata.lineOfBusiness 0 string false true metadata.agentNumber 0 string false true documentType 0 string true true contractId 0 string true true partyId 0 string true true scheduledTaskId 0 string false true additionalInformation[:] 0 string-map false true AVRO org.apache.kafka.common.serialization.StringSerializer string V28AF38A7174F0E16B5B2129E258DD5C049DEFE0F574CB3C3582433E9FD1986D08C70B7EE60A7DDB6F5DBEED250E28296E

`

KloadGen Version

KloadGn 4.3.0.7

Relevant log output

2022-05-12 15:18:14,068 WARN o.a.k.c.NetworkClient: [Producer clientId=] Error connecting to node broker:29092 (id: 1 rack: null)
java.net.UnknownHostException: broker
    at java.net.InetAddress$CachedAddresses.get(InetAddress.java:797) ~[?:?]
    at java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[?:?]
    at java.net.InetAddress.getAllByName(InetAddress.java:1364) ~[?:?]
    at java.net.InetAddress.getAllByName(InetAddress.java:1298) ~[?:?]
    at org.apache.kafka.clients.DefaultHostResolver.resolve(DefaultHostResolver.java:27) ~[kloadgen-4.3.0.jar:?]
    at org.apache.kafka.clients.ClientUtils.resolve(ClientUtils.java:110) ~[kloadgen-4.3.0.jar:?]

Have you added your JMX Testplan or a replica?

Have you added your Schema or a replica?

github-actions[bot] commented 2 years ago

Thank you for collaborating with the project by giving us feedback!!' You will help us a lot if you can attach an example AVRO and an example Test Plan in order to be able to reproduce the error, if that is the case. Cheers

irodigl commented 2 years ago

Hi @galegofer,

I investigated your problem and I'm sorry to tell you that docker hasn't access to name service of the local computer. For solving this, there are two options: You can use extern services or add the name to the host file on your computer. I recommend you the second, so:

  1. Access to the host file (".../etc/host")
  2. Add a new line with: 127.0.0.1 broker
galegofer commented 2 years ago

Hi @irodigl ,

I was trying the opposite broker! 127.0.0.1, I just inverted it, as you said, and voila!

Thanks a lot!