Skip to content

Failed to create topic error code val=-197 #1257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
7 tasks
cjfarnold opened this issue Jan 6, 2022 · 4 comments
Closed
7 tasks

Failed to create topic error code val=-197 #1257

cjfarnold opened this issue Jan 6, 2022 · 4 comments

Comments

@cjfarnold
Copy link

Description

Hi I am not able to create a topic using the confluent python API using the CLI provided by Kafka I am able to create the topics.

How to reproduce

Install Kafka version 2.12-2.8.1 on Windows
local requirements.txt for kafla client in python has the following
confluent-kafka[avro, json, protobuf]>=1.4.2

clientlogs

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()):
  • Apache Kafka broker version:
  • Client configuration: {...}
  • Operating system:
  • Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical issue
@edenhill
Copy link
Contributor

edenhill commented Jan 6, 2022

Please try to reproduce on the latest version (1.7.0).

If still an issue, provide logs when configured with 'debug': 'broker,admin,protocol' and also provide the code for your CreateTopics call.

@cjfarnold
Copy link
Author

cjfarnold commented Jan 7, 2022 via email

@jliunyu
Copy link
Contributor

jliunyu commented Jan 25, 2022

Hi @cjfarnold , thanks for asking. I think the error is caused by your class definition and code in constructor, I wrote it for you, hope it helps:

Topics = ["InitiateMatch","CompleteMatch"]
class setupTopics:
    def __init__(self):
        self.a = AdminClient({'bootstrap.servers': '127.0.0.1:9092',
                              'debug':'broker,admin,protocol',
                              'compression.type':'none',
                              'group.id':'mygroup'})
        newtopics = [NewTopic(topic, num_partitions=1, replication_factor=1)
            for topic in Topics]
        self.a.create_topics(newtopics)

def main():
    s = setupTopics()

@razorcd
Copy link

razorcd commented Jul 19, 2023

faced same error with:

    newtopic = NewTopic("bbb1", num_partitions=3, replication_factor=1)
    fs = AdminClient(kafkaConfig).create_topics([newtopic])

this worked:

    a = AdminClient(kafkaConfig)
    newtopic = NewTopic("bbb1", num_partitions=3, replication_factor=1)
    fs = a.create_topics([newtopic])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants