[Schema Registry] REST API call to test for master.eligibility == false?

1,667 views
Skip to first unread message

erik.p...@expeditors.com

unread,
Jun 13, 2018, 5:28:10 PM6/13/18
to Confluent Platform

Is there a Schema Registry API to test directly for master.eligibility == false?

It looks like all write operations against non-master eligible clusters do fail with a RestClientException and error code 50004 (UNKNOWN_MASTER_ERROR_CODE) but I was wondering if there is a cleaner way to read this configuration from a Schema Registry instance without resorting to using a write operation and test error codes.

Is there another way?  If not, do you think the addition would be helpful?

In our case we have Schema Registry utilities which can run in either master or non-master eligible clusters and for some it would be good to know upfront that only read operations are permitted when running in the non-master eligible clusters.

Thanks.

--erikp--

mag...@confluent.io

unread,
Jun 19, 2018, 4:30:42 PM6/19/18
to Confluent Platform
Do you have more than one SR cluster? WIthin a given cluster, slave nodes should be able to redirect write requests to the master. If you can detail out your deployment details, I can probably help you more on this.

Thanks
Magesh

白云翔

unread,
Jun 18, 2020, 11:52:38 PM6/18/20
to Confluent Platform
Hi Magesh,

  I'm get the same issue when I register a new schema.
  
curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json"     --data '{"schema": "{\"type\":\"record\",\"name\":\"SAP_MATL_GRP4_LOOKUP\",\"namespace\":\"key.SOURCEDB.SODS1\", \"fields\":[{\"name\":\"SAP_MATL_GRP_4_COND_CODE\",\"type\":\"string\",\"length\":\"3\"}]}" }'    http://ccp.dsw-dia-dataflow-prod.us-south.containers.appdomain.cloud:18081/subjects/odsprod.sods1.sap_matl_grp4_lookup-key/versions
{"error_code":50004,"message":"Master not known."}

We deploy schema registry in Kubernetes with image confluentinc/cp-schema-registry:5.3.1
 
Only one pod running. In the backend, we have three Kafka pod

SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS:  PLAINTEXT://dswes-ccpcls-cp-kafka-headless:9092

dswes-ccpcls-cp-kafka-headless       ClusterIP   None             <none>        9092/TCP            29d

arthur@localhost:~/Documents/GitRepository/schema-registry$ kc describe service dswes-ccpcls-cp-kafka-headless
Name:              dswes-ccpcls-cp-kafka-headless
Namespace:         confluent
Selector:          app=cp-kafka,release=dswes-ccpcls

$ kc get pods -l app=cp-kafka,release=dswes-ccpcls
NAME                      READY   STATUS    RESTARTS   AGE
dswes-ccpcls-cp-kafka-0   2/2     Running   0          24d
dswes-ccpcls-cp-kafka-1   2/2     Running   0          29d
dswes-ccpcls-cp-kafka-2   2/2     Running   0          29d


Also, in the schema registry container,  we already have set the master.eligibility=true, why we still get 50004 error??

root@dswes-ccpcls-cp-schema-registry-785dc54f55-r24cg:/# cat /etc/schema-registry/schema-registry.properties
kafkastore
.group.id=dswes-ccpcls
master
.eligibility=true
kafkastore
.bootstrap.servers=PLAINTEXT://dswes-ccpcls-cp-kafka-headless:9092


Do you have any idea on this?


在 2018年6月20日星期三 UTC+8上午4:30:42,mag...@confluent.io写道:

Erik Pearson

unread,
Jun 19, 2020, 2:53:48 AM6/19/20
to Confluent Platform
I don't know if Confluent ever added such a call to the Schema Registry REST API.

However, if you have JMX enabled for your Schema Registry instance(s) you can check the master status of that instance via the "kafka.schema.registry:type=master-slave-role" MBean.  This MBean will either have a 1.0 or 0.0 depending if that instance is a master or not so you could use that to check if your SR is a master.

Is there any errors in the logs?  You can also try setting 'debug=true' in the SR properties.  We've had to do that before.


--erikp--
Reply all
Reply to author
Forward
0 new messages