인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

33382water님의 프로필 이미지
33382water

작성한 질문수

카프카 완벽 가이드 - 코어편

Java 기반에서 Producer 구현하기 - 02

연결 에러

작성

·

34

0

PM 4:18:45: Executing ':producers:com.example.kafka.SimpleProducer.main()'…

> Task :producers:compileJava UP-TO-DATE

> Task :producers:processResources NO-SOURCE

> Task :producers:classes UP-TO-DATE

> Task :producers:com.example.kafka.SimpleProducer.main()

[main] INFO org.apache.kafka.clients.producer.ProducerConfig - ProducerConfig values:

acks = -1

batch.size = 16384

bootstrap.servers = [192.168.56.101:9092]

buffer.memory = 33554432

client.dns.lookup = use_all_dns_ips

client.id = producer-1

compression.type = none

connections.max.idle.ms = 540000

delivery.timeout.ms = 120000

enable.idempotence = true

interceptor.classes = []

key.serializer = class org.apache.kafka.common.serialization.StringSerializer

linger.ms = 0

max.block.ms = 60000

max.in.flight.requests.per.connection = 5

max.request.size = 1048576

metadata.max.age.ms = 300000

metadata.max.idle.ms = 300000

metric.reporters = []

metrics.num.samples = 2

metrics.recording.level = INFO

metrics.sample.window.ms = 30000

partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner

receive.buffer.bytes = 32768

reconnect.backoff.max.ms = 1000

reconnect.backoff.ms = 50

request.timeout.ms = 30000

retries = 2147483647

retry.backoff.ms = 100

sasl.client.callback.handler.class = null

sasl.jaas.config = null

sasl.kerberos.kinit.cmd = /usr/bin/kinit

sasl.kerberos.min.time.before.relogin = 60000

sasl.kerberos.service.name = null

sasl.kerberos.ticket.renew.jitter = 0.05

sasl.kerberos.ticket.renew.window.factor = 0.8

sasl.login.callback.handler.class = null

sasl.login.class = null

sasl.login.connect.timeout.ms = null

sasl.login.read.timeout.ms = null

sasl.login.refresh.buffer.seconds = 300

sasl.login.refresh.min.period.seconds = 60

sasl.login.refresh.window.factor = 0.8

sasl.login.refresh.window.jitter = 0.05

sasl.login.retry.backoff.max.ms = 10000

sasl.login.retry.backoff.ms = 100

sasl.mechanism = GSSAPI

sasl.oauthbearer.clock.skew.seconds = 30

sasl.oauthbearer.expected.audience = null

sasl.oauthbearer.expected.issuer = null

sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000

sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000

sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100

sasl.oauthbearer.jwks.endpoint.url = null

sasl.oauthbearer.scope.claim.name = scope

sasl.oauthbearer.sub.claim.name = sub

sasl.oauthbearer.token.endpoint.url = null

security.protocol = PLAINTEXT

security.providers = null

send.buffer.bytes = 131072

socket.connection.setup.timeout.max.ms = 30000

socket.connection.setup.timeout.ms = 10000

ssl.cipher.suites = null

ssl.enabled.protocols = [TLSv1.2, TLSv1.3]

ssl.endpoint.identification.algorithm = https

ssl.engine.factory.class = null

ssl.key.password = null

ssl.keymanager.algorithm = SunX509

ssl.keystore.certificate.chain = null

ssl.keystore.key = null

ssl.keystore.location = null

ssl.keystore.password = null

ssl.keystore.type = JKS

ssl.protocol = TLSv1.3

ssl.provider = null

ssl.secure.random.implementation = null

ssl.trustmanager.algorithm = PKIX

ssl.truststore.certificates = null

ssl.truststore.location = null

ssl.truststore.password = null

ssl.truststore.type = JKS

transaction.timeout.ms = 60000

transactional.id = null

value.serializer = class org.apache.kafka.common.serialization.StringSerializer

[main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka version: 3.1.0

[main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka commitId: 37edeed0777bacb3

[main] INFO org.apache.kafka.common.utils.AppInfoParser - Kafka startTimeMs: 1735715926395

[kafka-producer-network-thread | producer-1] INFO org.apache.kafka.clients.Metadata - [Producer clientId=producer-1] Resetting the last seen epoch of partition simple-topic-0 to 0 since the associated topicId changed from null to wPaCJ0MWQ1iZ8YrJVqk8zA

[kafka-producer-network-thread | producer-1] INFO org.apache.kafka.clients.Metadata - [Producer clientId=producer-1] Cluster ID: 7AaNgISvTZmWslFvoaATIA

[kafka-producer-network-thread | producer-1] WARN org.apache.kafka.clients.NetworkClient - [Producer clientId=producer-1] Error connecting to node min-VirtualBox:9092 (id: 0 rack: null)

java.net.UnknownHostException: min-VirtualBox: nodename nor servname provided, or not known

at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933)

at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1529)

at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)

at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1519)

at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1377)

at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1305)

at org.apache.kafka.clients.DefaultHostResolver.resolve(DefaultHostResolver.java:27)

at org.apache.kafka.clients.ClientUtils.resolve(ClientUtils.java:110)

at org.apache.kafka.clients.ClusterConnectionStates$NodeConnectionState.currentAddress(ClusterConnectionStates.java:511)

at org.apache.kafka.clients.ClusterConnectionStates$NodeConnectionState.access$200(ClusterConnectionStates.java:468)

at org.apache.kafka.clients.ClusterConnectionStates.currentAddress(ClusterConnectionStates.java:173)

at org.apache.kafka.clients.NetworkClient.initiateConnect(NetworkClient.java:984)

at org.apache.kafka.clients.NetworkClient.ready(NetworkClient.java:301)

at org.apache.kafka.clients.producer.internals.Sender.sendProducerData(Sender.java:354)

at org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:327)

at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:243)

at java.base/java.lang.Thread.run(Thread.java:833)

 

그리고 sudo vi/ etc/hosts로192.168.56.101 min hosts 세팅은 완료했습니다

답변 2

0

권 철민님의 프로필 이미지
권 철민
지식공유자

안녕하십니까,

실습 java code에서 오류가 나는 건가요? 실습 코드대로 작성하신 건지요?

먼저 아래 오류 코드를 보시면 java client에서 min-VirtualBox로 연결되는데 이렇게 되면 접속이 안될 겁니다.

java.net.UnknownHostException: min-VirtualBox: nodename nor servname provided, or not known

실습코드대로 bootstrap.servers에 192.168.56.101:9092를 잘 설정하셨다면, 실습 환경대로 vm 환경을 설정하셨는지, 다시 확인해 보시고, 혹 로컬 PC에 DNS설정을 뭔가 작업하신 부분이 없는지 확인 부탁드립니다. 그리고 Broker도 잘 기동되어 있는지 확인 부탁드립니다.

감사합니다.

 

0

33382water님의 프로필 이미지
33382water
질문자

ping 잘 날아가구요..192.168.56.101 이쪽으로..

33382water님의 프로필 이미지
33382water

작성한 질문수

질문하기