cp-docker-images icon indicating copy to clipboard operation
cp-docker-images copied to clipboard

Can't start schemaregistry

Open guitcastro opened this issue 5 years ago • 10 comments

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?

guitcastro avatar May 16 '19 15:05 guitcastro

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

OneCricketeer avatar Sep 25 '19 12:09 OneCricketeer

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

TonyTromp avatar Feb 20 '20 07:02 TonyTromp

@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

OneCricketeer avatar Feb 20 '20 13:02 OneCricketeer

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

zhenik avatar Feb 20 '20 15:02 zhenik

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 avatar Feb 20 '20 16:02 OneCricketeer

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)

OneCricketeer avatar Feb 20 '20 16:02 OneCricketeer

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.

zhenik avatar Feb 21 '20 15:02 zhenik

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

OneCricketeer avatar Feb 21 '20 15:02 OneCricketeer

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.

zhenik avatar Feb 21 '20 15:02 zhenik

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.

Victoremepunto avatar Jul 13 '20 15:07 Victoremepunto