confluentinc / cp-docker-images

[DEPRECATED] Docker images for Confluent Platform.
Apache License 2.0
1.14k stars 705 forks source link

Can't start schemaregistry #734

Open guitcastro opened 5 years ago

guitcastro commented 5 years ago

I am trying to start the schema registry docker image with the following configs:

  schema-registry:
    image: confluentinc/cp-schema-registry:5.1.3
    network_mode: "host"
    environment:
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: "localhost:2181"
      SCHEMA_REGISTRY_HOST_NAME: localhost
      SCHEMA_REGISTRY_LISTENERS: "http://localhost:8081"
    depends_on:
      - kafka
    ports:
      - "8081:8081"

Although I am facing the following error:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain.main(SchemaRegistryMain.java:41)
Caused by: io.confluent.common.config.ConfigException: Invalid value java.net.UnknownHostException: linuxkit-025000000001: linuxkit-025000000001: Name or service not known for configuration Unknown local hostname
    at io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig.getDefaultHost(SchemaRegistryConfig.java:405)
    at io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig.<clinit>(SchemaRegistryConfig.java:259)

Any ideias?

OneCricketeer commented 4 years ago

Is there a specific reason you need to use host network mode?

TonyTromp commented 4 years ago

Any answers to this one? Seems we are facing the same issue even without the docker container.

OneCricketeer commented 4 years ago

@TonyTromp please show a SSCCE of downloading and starting everything.

If it didn't start correctly, you'd obviously seen more issues and comments here

The error in the first post is the fact that localhost is always going to be the schema registry itself, not Zookeeper or Kafka

zhenik commented 4 years ago

I have a similar problem, but I have run everything using HashiCorp consul and nomad. More than that, I am trying to build PoC of a service mesh for standalone kafka cluster (1-zookeeper & 1-kafka-broker & 1-schema-registry). I put all containers behind envoy proxy, this feature comes from box - consul-connect.

I have repository, where I put create readme file with steps to reproduce this problem. https://github.com/zhenik-poc/hashicorp-stacks/blob/master/learn/consul-connect/kafka/issue-734.md

OneCricketeer commented 4 years ago

I'm able to run Schema Registry in nomad.

Haven't tried Zookeeper or Kafka

But the issues you'll run into is each of the LISTENERS variables between kafka and the registry as well as other clients

OneCricketeer commented 4 years ago

As I've pointed out already localhost/127.0.0.1 is almost never the correct address when working with Docker services

https://github.com/zhenik-poc/hashicorp-stacks/blob/master/learn/consul-connect/kafka/kafka.hcl#L18-L21

KAFKA_LISTENERS should be 0.0.0.0

Understand what the advertised listeners are https://www.confluent.io/blog/kafka-listeners-explained/

For Nomad, use the Zookeeper Consul DNS name, not localhost. Use the correct ports, not 9181 (unless you changed it for some reason)

For Schema Registry, I would suggest not using Zookeeper and use the Kafka-based election mode (refer to the documentation)

zhenik commented 4 years ago

Thank you @cricket007 for useful info and links. As I said the case is a bit specific due to the use of consul-connect. Env: zookeeper, kafka and schema registry. Each node behind envoy proxy and the communicate via loopback and side_car proxy (envoy). Yes, I can use consul-dns, but it is not the point.

The current problem is not a communication between nodes (I tested differently already, it works fine, except schema-registry via nomad). The concrete problem in the container's hostname. I cannot override it by using nomad property hostname, cause I use bridge network. I cannot use nomad property extra_hosts due to bridge network also. I understand that changing /etc/hosts is adhoc solution and should be avoided. Which was described in blog post.

I think this issue is about how to resolve a hostname for node where schema-registry is deployed.
I wonder is it an issue when schema-registry deployed on k8s.

I'll keep digging.

OneCricketeer commented 4 years ago

k8s uses the service DNS name.

You should be able to use some similar nomad env var to get that information.

For debugging purposes, you may want to not use Consul connect until you have direct service interaction working. In particular, I don't think the Envoy Kafka protocol is fully complete yet

zhenik commented 4 years ago

For debugging purposes, you may want to not use Consul connect until you have direct service interaction working. In particular, I don't think the Envoy Kafka protocol is fully complete yet

Yeah Filters for zookeeper at alpha stage . And Kafka broker filters supports 2.4 Kafka .

Thx for help.

Victoremepunto commented 4 years ago

I was running into issues until I set the hostname parameter to localhost, or I guess the same value as the SCHEMA_REGISTRY_HOST_NAME variable.