0
votes

I have an environment problem. I want using zookeeper and Kafka cluster to solve my problem.

My zookeeper version is 3.4.12 and Kafka is 2.12-2.1.0

I also change the zoo.cfg in zookeeper.

dataDir=D:/WEBSOCKET/zookeeper-3.4.12/data

and server.properties in kafka.

log.dirs=D:/WEBSOCKET/kafka_2.12-2.1.0/logs

I see all the tutorial and do it the exact same way. And also usgin kafka open zookeeper.

this is my command:

1) open zookeeper (zkServer.cmd)

2) in kafka

.\bin\windows\kafka-server-start.bat .\config\server.properties

3) create topic

.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic hello

4) create a producer

.\bin\windows\kafka-console-producer.bat --bootstrap-server localhost:2181 --topic hello

5) create a consumer

.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:2181 --topic hello

when I get in step 5, I always fail. zookeeper will give me a lot of console like :

 WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: null
 INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /127.0.0.1:55192

and

2019-01-08 17:05:24,822 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1040] - Closed socket connection for client /127.0.0.1:50874 (no session established for client)
2019-01-08 17:05:25,783 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /127.0.0.1:56089

I don't know how to fix it. I google for two days...

when I open my Kafka with step 2, my zookeeper some times doesn't hvae any response or shows me this:

 [ProcessThread(sid:0 cport:2181)::PrepRequestProcessor@596] - Got user-level KeeperException when processing sessionid:0x1000058f8960000 type:multi cxid:0x36 zxid:0x69 txntype:-1 reqpath:n/a aborting remaining multi ops. Error Path:/admin/preferred_replica_election Error:KeeperErrorCode = NoNode for /admin/preferred_replica_election

I also google this, but not helpful.

I set this in kfaka before: advertised.host.name = localhost listeners=PLAINTEXT://127.0.0.1:9092

my host have set 127.0.0.1 localhost

please help me create local server I want to coding my project..

thank you read all.

1
"when I get in step 5, I always fail" What happens? Do you see any errors? Can you paste the logs of the kafka-console-consumer.bat tool with TRACE enabled?Mickael Maison
You do not need to edit your hosts file...OneCricketeer

1 Answers

0
votes

Producers and consumers need to use port 9092 (Kafka)

You are seeing Zookeeper logs and errors because you are trying to use bootstrap-server or broker-list and port 2181 (Zookeeper)

Check again the quickstart guide