Schema Registry Connection Refused

2,616 views
Skip to first unread message

IceWarmer

unread,
Jun 15, 2017, 9:36:59 AM6/15/17
to Confluent Platform
I checked that the hostname can be resolved and that the port works by running a socket when the container starts.

1 of 3 attempts to connect to schema-registry/172.18.0.4:8081
[main] INFO Readiness - Connecting to schema-registry/172.18.0.4:8081 successful

But when I use the CachedSchemaRegistryClient to register a schema form the same container, it throws a Connection Refused exception. 

ERROR io.confluent.kafka.schemaregistry.client.rest.RestService - Failed to send HTTP request to endpoint: http://schema-registry/172.18.0.4:8081/subjects/FindRecentReviews/versions
java
.net.ConnectException: Connection refused (Connection refused)
    at java
.net.PlainSocketImpl.socketConnect(Native Method)
    at java
.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java
.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java
.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java
.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java
.net.Socket.connect(Socket.java:589)
    at java
.net.Socket.connect(Socket.java:538)
    at sun
.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun
.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun
.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun
.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at sun
.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun
.net.www.http.HttpClient.New(HttpClient.java:357)
    at sun
.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
    at sun
.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
    at sun
.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
    at sun
.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
    at sun
.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
    at sun
.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
    at io
.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:142)
    at io
.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:187)
    at io
.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:238)
    at io
.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:230)
    at io
.confluent.kafka.schemaregistry.client.rest.RestService.registerSchema(RestService.java:225)
    at io
.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.registerAndGetId(CachedSchemaRegistryClient.java:59)
    at io
.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.register(CachedSchemaRegistryClient.java:91)
    at science
.peers.message.model.MessageSchemaRegistry.register(MessageSchemaRegistry.scala:27)
    at science
.peers.protocol.AvroBinarySerializable.toByteArray(BinarySerializable.scala:30)
    at science
.peers.protocol.AvroBinarySerializable.toByteArray$(BinarySerializable.scala:26)
    at science
.peers.unsorted.protocol.FindRecentReviews.toByteArray(UnsortedOrder.scala:105)
    at science
.peers.message.model.serializers.MessageSerializer.serializeImpl(MessageSerializer.scala:27)
    at science
.peers.message.model.serializers.MessageSerializer.serialize(MessageSerializer.scala:22)
    at org
.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:463)
    at org
.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:440)

This is my docker compose file.

# For development purposes
version
: '3'

services
:
  kafka
:
    image
: confluentinc/cp-kafka:3.2.1
    hostname
: kafka
    container_name
: kafka
    depends_on
:
   
- zookeeper
    environment
:
      KAFKA_BROKER_ID
: 1
      KAFKA_ZOOKEEPER_CONNECT
: zookeeper:32181
      KAFKA_ADVERTISED_LISTENERS
: PLAINTEXT://kafka:29092
   
  zookeeper
:
    image
: confluentinc/cp-zookeeper:3.2.1
    hostname
: zookeeper
    container_name
: zookeeper
    environment
:
      ZOOKEEPER_CLIENT_PORT
: 32181
      ZOOKEEPER_TICK_TIME
: 2000

  schema
-registry:
    image
: confluentinc/cp-schema-registry:3.2.1
    hostname
: schema-registry
    container_name
: schema-registry
    depends_on
:
   
- zookeeper
   
- kafka
    environment
:
      SCHEMA_REGISTRY_HOST_NAME
: 0.0.0.0
      SCHEMA_REGISTRY_LISTENERS
: http://0.0.0.0:8081
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL
: zookeeper:32181

  web
-server:
    image
: my-image:0.0.1
    container_name
: my_image
    ports
:
   
- "8080:8080"

MR

unread,
Jun 16, 2017, 11:10:32 PM6/16/17
to Confluent Platform
Hello,

I am getting same error. Were you able to resolve this error?

Thanks!!

IceWarmer

unread,
Jun 16, 2017, 11:35:36 PM6/16/17
to Confluent Platform
Nope. This is the only thing blocking though.  I wonder if it is because I am running schema registry on my local dev machine. 

MR

unread,
Jun 17, 2017, 3:21:30 PM6/17/17
to Confluent Platform
Issue is resolved for me but I am on a 3 Node cluster and not using docker. Try giving ZK namespace in SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL and see if it resolves the issue.

IceWarmer

unread,
Jun 18, 2017, 3:00:49 AM6/18/17
to Confluent Platform
Hi, Are you running confluent on Minikube?  If so, are you running both the schema-registry and kafka on the same pod?  I tried doing that before but both schema registry and kafka would fail to start.  Would you mind if I share my yaml file for to take a look at?

mayank rathi

unread,
Jun 18, 2017, 5:26:40 AM6/18/17
to confluent...@googlegroups.com
No. I just downloaded tar balls from confluent and used those to configure Kafka on my cluster.

--
You received this message because you are subscribed to a topic in the Google Groups "Confluent Platform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/confluent-platform/WxYrul1bqs0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to confluent-platform+unsub...@googlegroups.com.
To post to this group, send email to confluent-platform@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/confluent-platform/7f783cc5-e5bf-436b-8b4f-9d4dad765687%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

Ewen Cheslack-Postava

unread,
Jun 28, 2017, 2:22:45 AM6/28/17
to Confluent Platform
http://schema-registry/172.18.0.4:8081/subjects/FindRecentReviews/versions doesn't look like a valid URL -- it looks like you have `schema-registry` as a host but are also adding an IP and port. The IP and port also is probably not correct given your docker-compose since the 8081 port is probably only valid within the container. It doesn't look like you have a port mapping that would make that valid. Perhaps you need to set an advertised host/port to and/or use a different host/port to access the schema registry?

-Ewen

To unsubscribe from this group and all its topics, send an email to confluent-platform+unsubscribe@googlegroups.com.



--
NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

--
You received this message because you are subscribed to the Google Groups "Confluent Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to confluent-platform+unsub...@googlegroups.com.

To post to this group, send email to confluent-platform@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages