我对 Confluent KSql 很陌生,但对 Kafka 并不陌生。我有作为 Avro 序列化数据存在于 Kafka 中的现有主题。我已经启动并运行了 Confluent 模式注册表,并将 KSql 配置为指向注册表。
当我尝试根据我的一个主题创建一个表时,KSql 抱怨它找不到流。当我尝试在 KSql 中创建一个仅在 KSql 中流式传输我的主题的流时,似乎无法指向在注册表中有引用的我的 Avro 序列化主题。
有谁知道如何解决这两个问题?我想使用 KSql 的方式不适合它的功能吗?
更新
这里有更多细节
ksql> show topics;
Kafka Topic | Registered | Partitions | Partition Replicas | Consumers | Consumer Groups
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COM_FINDOLOGY_MODEL_REPORTING_OUTGOINGFEEDADVERTISERSEARCHDATA | false | 2 | 2 | 0 | 0
COM_FINDOLOGY_MODEL_TRAFFIC_CPATRACKINGCALLBACK | false | 2 | 2 | 0 | 0
COM_FINDOLOGY_MODEL_TRAFFIC_ENTRYPOINTCLICK | true | 10 | 3 | 0 | 0
KSql 配置
#bootstrap.servers=localhost:9092
bootstrap.servers=host1:9092,host2:9092,host3:9092,host4:9092,host5:9092
#listeners=http://localhost:8088
listeners=http://localhost:59093
ksql.server.ui.enabled=true
ksql.schema.registry.url=http://host1:59092
注册表配置
# The host name advertised in ZooKeeper. Make sure to set this if running Schema Registry with multiple nodes.
host.name: x.x.x.x
listeners=http://0.0.0.0:59092
# Zookeeper connection string for the Zookeeper cluster used by your Kafka cluster
# (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
#kafkastore.connection.url=localhost:2181
# Alternatively, Schema Registry can now operate without Zookeeper, handling all coordination via
# Kafka brokers. Use this setting to specify the bootstrap servers for your Kafka cluster and it
# will be used both for selecting the master schema registry instance and for storing the data for
# registered schemas.
# (Note that you cannot mix the two modes; use this mode only on new deployments or by shutting down
# all instances, switching to the new configuration, and then starting the schema registry
# instances again.)
kafkastore.bootstrap.servers=PLAINTEXT://host1:9092,PLAINTEXT://host2:9092,PLAINTEXT://host3:9092,PLAINTEXT://host4:9092,PLAINTEXT://host5:9092
# The name of the topic to store schemas in
kafkastore.topic=_schemas
# If true, API requests that fail will include extra debugging information, including stack traces
debug=false
尝试通过声明外部主题来解决问题
ksql> register topic xxx with (value_format='avro', kafka_topic='COM_FINDOLOGY_MODEL_REPORTING_OUTGOINGFEEDADVERTISERSEARCHDATA');
You need to provide avro schema file path for topics in avro format.