在我的本地计算机中安装了独立的ksqlDB。
运行ksql服务器时,我收到以下错误
Remote server at http://ksqldb-server:8088 does not appear to be a valid KSQL
server. Please ensure that the URL provided is for an active KSQL server.
The server responded with the following error:
Error issuing GET to KSQL server. path:/info
Caused by: java.net.UnknownHostException: failed to resolve 'ksqldb-server'
after 2 queries
Caused by: failed to resolve 'ksqldb-server' after 2 queries
PS:我的docker-compose.yml看起来如下
---
version: '2'
services:
ksqldb-server:
image: confluentinc/ksqldb-server:0.23.1
hostname: ksqldb-server
container_name: ksqldb-server
ports:
- "8088:8088"
environment:
KSQL_LISTENERS: http://0.0.0.0:8088
KSQL_BOOTSTRAP_SERVERS: localhost:9092
KSQL_KSQL_LOGGING_PROCESSING_STREAM_AUTO_CREATE: "true"
KSQL_KSQL_LOGGING_PROCESSING_TOPIC_AUTO_CREATE: "true"
ksqldb-cli:
image: confluentinc/ksqldb-cli:0.23.1
container_name: ksqldb-cli
depends_on:
- ksqldb-server
entrypoint: /bin/sh
tty: true
运行docker-composition up时,出现以下错误
[2022-01-11 07:21:54,280] INFO [AdminClient clientId=adminclient-1] Metadata update failed (org.apache.kafka.clients.admin.internals.AdminMetadataManager:235)
ksqldb-server | org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
ksqldb-server | [2022-01-11 07:21:54,282] ERROR Failed to start KSQL (io.confluent.ksql.rest.server.KsqlServerMain:68)
ksqldb-server | java.lang.RuntimeException: Failed to get Kafka cluster information
ksqldb-server | at io.confluent.ksql.services.KafkaClusterUtil.getKafkaClusterId(KafkaClusterUtil.java:107)
ksqldb-server | at io.confluent.ksql.rest.server.KsqlRestApplication.buildApplication(KsqlRestApplication.java:669)
ksqldb-server | at io.confluent.ksql.rest.server.KsqlServerMain.createExecutable(KsqlServerMain.java:154)
ksqldb-server | at io.confluent.ksql.rest.server.KsqlServerMain.main(KsqlServerMain.java:61)
ksqldb-server | Caused by: java.util.concurrent.TimeoutException
ksqldb-server | at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1886)
ksqldb-server | at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2021)
ksqldb-server | at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
ksqldb-server | at io.confluent.ksql.services.KafkaClusterUtil.getKafkaClusterId(KafkaClusterUtil.java:105)
ksqldb-server | ... 3 more
ksqldb-server exited with code 255
^CGracefully stopping... (press Ctrl+C again to force)
Stopping ksqldb-cli ... done
在server.properties文件中,我添加了
listeners=PLAINTEXT://localhost:9092
重新开始Kafka,但并没有解决问题。
Kafka的消费者和生产者工作正常。问题只出在kSQL上
任何帮助都很感激
1条答案
按热度按时间guz6ccqo1#
此配置中有两个错误:
1.您需要在ksqldb-server yaml中指定用于公开kafka-cluster的服务的名称,如果您使用strimzi,则通常以“kafka-bootstrap”结束
1.第二个错误是,您还需要公开ksqldb-server,以便ksql-cli可以使用ENV变量KSQL_BOOTSTRAP_SERVERS连接到该服务器。
如果你想有一个模板ksql-db-service从helm图表,你可以用途:
如果你还没有的话,你需要为Kafka做一件类似的事情,但是要公开端口9092。
但是这个过程可能容易出错,因为你必须手工编写大量的yaml。没有必要重新发明轮子。使用helm图表和操作符!
您可以使用此作业模板执行查询:
你可以模板更好的yaml-job,但不想把事情复杂化
如果有什么不清楚的地方请告诉我