How to delete Kafka topic using Kafka REST Proxy?
Asked Answered
L

5

6

How to delete Kafka topic using Kafka REST Proxy? I tried the following command, but it returns the error message:

curl -X DELETE XXX.XX.XXX.XX:9092/topics/test_topic

If it's impossible, then how to update delete the messages and update the scheme of a topic?

Lucilius answered 4/1, 2017 at 11:8 Comment(0)
O
6

According to the documentation API Reference, you cannot delete topics via REST Proxy, and I agree with them because such a destructive operation should not be available via interface that is exposed to outside.

The topic deletion operation can be performed on the server where broker runs using command line utility. See How to Delete a topic in apache kafka

Observable answered 4/1, 2017 at 18:48 Comment(0)
A
2

You can update the schema for a message when you publish it using the POST /topics/(string: topic_name) REST endpoint. If the schema for the new messages is not backward compatible with the older messages in the same topic you will have to configure your Schema Registry to allow publishing of incompatible messages, otherwise you will get an error.

See the "Example Avro request" here: http://docs.confluent.io/3.1.1/kafka-rest/docs/api.html#post--topics-(string-topic_name)

See how to configure Schema Registry for forward, backward, or no compatibility see the documentation here: http://docs.confluent.io/3.1.1/schema-registry/docs/api.html#compatibility

Algology answered 4/1, 2017 at 20:4 Comment(0)
G
0

I confirmed that it is supported from version 5.5.0 or higher, and the test result worked normally. (REST Proxy API v3)

https://docs.confluent.io/current/kafka-rest/api.html#topic

Gogol answered 8/10, 2020 at 11:29 Comment(0)
P
0

It's pretty simple. When You delete your topic in control center and realise(Use Inspect feature to sniff browser trafic) that deleting of topic is nothing but DELETE request to broker.

curl -s -X DELETE "http://kafka_broker:9021/2.0/kafka/${clusterid}/topics/${topic}"
Plaintiff answered 23/8, 2023 at 12:51 Comment(0)
G
0

according to rest proxy documentation, in order to delete a topic the call is this:

curl -X DELETE <REST_PROXY_URL>/clusters/<CLUSTER_ID>/topics/<TOPIC_NAME>
Gagliardi answered 13/12, 2023 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.