lensesio / kafka-topics-ui

Web Tool for Kafka Topics |
https://lenses.io
877 stars 148 forks source link

contectivity issue with confluent rest proxy for kafka #89

Closed aliartiza75 closed 7 years ago

aliartiza75 commented 7 years ago

Hello everyone,

I have locally deployed a kafka single node, I am trying to connect to the kafka's rest proxy but unable to connect to it.

/////////////////////////////////////////////////// Configurations in env.js file var clusters = [ { NAME: "prod", KAFKA_REST: "http://localhost:8082/", MAX_BYTES: "50000", // Sets the default maximum amount of bytes to fetch from each topic RECORD_POLL_TIMEOUT: "500", COLOR: "#141414", // Optional DEBUG_LOGS_ENABLED: true } ]; ///////////////////////////////////////////////////

/////////////////////////////////////////////////// Terminal output

irti@ubuntu:/bin$ confluent start kafka-rest Starting zookeeper zookeeper is [UP] kafka is already running. Try restarting if needed schema-registry is already running. Try restarting if needed Starting kafka-rest kafka-rest is [UP] ////////////////////////////////////////////////////

Above is the log of my terminal, which shows confluent rest proxy is running.

This is the log for the kafka-topics-ui server:

[Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "POST /127.0.0.1:8082/consumers/kafka_topics_ui_json_2017-10-18-12-30-08-556" Error (404): "Not found" [Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "GET /127.0.0.1:8082/topics" Error (404): "Not found" [Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "GET /127.0.0.1:8082/topics" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0" [Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "GET /127.0.0.1:8082/topics" Error (404): "Not found" [Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "GET /127.0.0.1:8082/brokers" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0" [Wed Oct 18 2017 00:30:08 GMT-0700 (PDT)] "GET /127.0.0.1:8082/brokers" Error (404): "Not found"

When I curl the same address this is the result: curl "http://localhost:8082/topics" ["_schemas","a","b","jsontest","topic-name"]

Need help!!! Thanks in advance

andmarios commented 7 years ago

One thing you could try, is curl http://127.0.0.1:8082/topics to make sure REST Proxy bind to IPv4 localhost address.

The most probable scenario is that the REST Proxy isn't sending CORS headers. You can either enable CORS for it or use our docker image (landoop/kafka-topics-ui) which lets you proxy the REST Proxy through the container's web server, effectively bypassing CORS.

If you decide to configure REST Proxy, the settings needed are:

access.control.allow.methods=GET,POST,PUT,DELETE,OPTIONS
access.control.allow.origin=*

But I am not sure where REST Proxy's configuration on Confluent's CLI is.

If you decide to go with our docker:

docker run --rm -e PROXY=true -p 8000:8000 -e "KAFKA_REST_PROXY_URL=http://127.0.0.1:8082" --net=host landoop/kafka-topics-ui
AgoloKarimTawfik commented 7 years ago

I tried it out and worked find without docker, I added the CORS fields under kafka-rest.properties under confluent-3.3.0/etc

gburgalum01 commented 7 years ago

@AgoloKarimTawfik I also ran into the "CONNECTIVITY ERROR" problem. I had a similar setup. I added the CORS fields that you suggested to the kafka-rest.properties file and set KAFKA_REST to be http://127.0.0.1:8082 in the env.js file. This worked for me. I'm thankful that you left the solution here for the rest of us. Thank you!