Access url for schema registry

Hello there,

i try to connect to the schema registery on hopsworks.ai from an external producer on my local machine, but i can’t figure out the right url. My code is down below.

schema_registry_conf = {‘url’: “da1b2ea0-f134-11eb-bc5d-cb0b7ed872e9.cloud.hopsworks.ai:8181/project/119/kafka”}
schema_registry_client = SchemaRegistryClient(schema_registry_conf)

It would be nice, if someone can help me there.

Best regards,
Akil

Hi @Akil_Guler

You can find an example here Use Python Kafka to interact with Hopsworks - Hopsworks, specifically under the Configuration File and Avro Producer sections. Also please note you will need to modify the accepted header in the schema registry client, as per the instructions under the Avro Producer section.

The url looks correct, excepts it’s missing the leading https://.

Hi @Theo,

thank you for the fast reply. I tried the example but get this error (see picture down below). My toml file looks like:
[hops]

url = ‘da1b2ea0-f134-11eb-bc5d-cb0b7ed872e9.cloud.hopsworks.ai’

verify = false

[project]
name = ‘Ameise’
id = ‘119’
ca_file = ‘cert/trustStore.pem’
certificate_file = ‘cert/keyStore.pem’
key_file = ‘cert/keyStore.pem’
key_password = ‘asdf123’

[kafka]
topic = ‘temperatur’
schema = ‘sensor’
port = ‘9092’

[kafka.consumer]
group_id = ‘testGroup’
auto_offset_reset = ‘earliest’

[api]
base = ‘/hopsworks-api/api’
key = ‘iOHXDWuKYDqnoe2o.k6STdolv4cgHmqIguGkbti5Vsx1e4cyqkjsQNHRI2NG4qFdPHUcFEtEbJvuFx’
key_file = ‘cert/apiKeyFile.txt’

If you find a mistake let me know. Thank you !

Best regards,
Akil

Hi,

The error indicates something wrong with the certificate files, the client does not trust the API server. Did you generate them the same way as shown in the tutorial? Is your Hopsworks cluster using a signed certificate?

Are you instantiating the SchemaRegistry like this?

 schema_registry_conf = {'url': registry_url, 'ssl.ca.location': conf['hops']['verify']}

Hi,

yes i do it as the same way as shown in the tutorial.

Are you also instantiating the SchemaRegistry client like this?

 schema_registry_conf = {'url': registry_url, 'ssl.ca.location': conf['hops']['verify']}

This will instruct the SchemaRegistry to now verify the https certificate. The stacktrace shows that the SchemaRegistry tires to verify the https connection and fails.

You can also hard-code it like that just to make sure

 schema_registry_conf = {'url': registry_url, 'ssl.ca.location': 'false'}

Also, is your Hopsworks cluster using a signed certificate?

Oh i didn’t checked that, where can i see the option ?

Do you mean about the signed certificate? That is an option when creating the hopsworks.ai cluster, under the Security Group option in the Create Cluster wizard.

It shouldn’t be required though if the SchemaRegistry is initialized with ssl.ca.location-false.

I did not specify a security group, while creating a hopsworks cluster and ssl.ca.location is set to false. I followed the tutorial step by step until this point including the creation the .pem-files.

Can you try removing the ssl.ca.location option entirely?

Also try setting it to False instead of 'false'

I tried it and it is the same error message nothing changed.

Thanks for the help, i solved the problem now its working ! :slight_smile:

Good to hear that! How did you manage to resolve the problem?

I had to update my cluster, then it was resolved.