KSQL - drop topic

只愿长相守 提交于 2019-12-11 06:59:39

问题


Is there a way to drop the topic from KSQL? According to github it is possible, and I tried

DROP TOPIC my-topic
DROP TOPIC "my-topic"
DROP TOPIC 'my-topic'
DROP TOPIC `my-topic`

But neither of this commands works. I get message

 Message
-------------------------------------------------------------------------------
 io.confluent.ksql.util.KsqlException: No topic with name true was registered.

回答1:


KSQL topic is different concept than Kafka topic. KSQL topic is an internal concept for KSQL that represents a kafka topic along with metadata about that topic including the topic format. Since we do not expose KSQL topic externally you should not use it in KSQL statements. If you wanna delete a kafka topic, you should delete it from kafka. In future we plan to add topic management capability to KSQL.




回答2:


When you create stream or table using a TOPIC then the topic gets registered in KSQL As shown below.

ksql> SHOW TOPICS;

Kafka Topic| Registered| Partitions | Partition Replicas | Consumers | Consumer Groups` 

---------------------------------------------------------------------------------------

 __confluent.support.metric| false      | 1          | 1                  | 0         | 0

_confluent-ksql-default__command_topic | true       | 1          | 1                  | 0         | 0

_schemas                               | false      | 1          | 1                  | 0         | 0

connect-configs                        | false      | 1          | 1                  | 0         | 0

connect-offsets                        | false      | 25         | 1                  | 0         | 0

connect-statuses                       | false      | 5          | 1                  | 0         | 0

email-filters                          | false      | 4          | 1                  | 0         | 0

Please observe the email-filters topics is saying Registered is false because there is no corresponding stream and table.

So when you try to drop it. like this :

ksql> DROP TOPIC "email-filters";

 Message
-----------------------------------------
 No topic with name true was registered.
-----------------------------------------
ksql>

So the answer is correct by @Hojjat is correct.

This is the explanation.



来源:https://stackoverflow.com/questions/47660043/ksql-drop-topic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!