英文:
Trying to start kafka , Schema registry in docker containers using Testcontainers
问题
我正在尝试在 Docker 容器中使用 Kotlin 进行集成测试和 Test containers 启动 Kafka 和 schemaregistry。以下是我的 Test containers 设置:
@Testcontainers
companion object {
@Container
val kafkaContainer = KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest")).apply {
setWaitStrategy(
Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofSeconds(75))
)
withEmbeddedZookeeper()
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:9093 ,BROKER://0.0.0.0:9092")
.withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT")
.withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "BROKER")
.withEnv("KAFKA_BROKER_ID", "1")
.withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1")
.withEnv("KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS", "1")
.withEnv("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "1")
.withEnv("KAFKA_TRANSACTION_STATE_LOG_MIN_ISR", "1")
.withEnv("KAFKA_LOG_FLUSH_INTERVAL_MESSAGES", Long.MAX_VALUE.toString())
.withEnv("KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS", "0")
.start()
}.withReuse(true)
@Container
val schemaRegistryContainer = GenericContainer(DockerImageName.parse("confluentinc/cp-schema-registry")).apply {
withExposedPorts(8081)
withEnv("SCHEMA_REGISTRY_HOST_NAME", "schema-registry")
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://localhost:8081")
withEnv("SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS", kafkaContainer.bootstrapServers)
withNetwork(kafkaContainer.network)
start()
}
@DynamicPropertySource
@JvmStatic
fun kafkaProperties(registry: DynamicPropertyRegistry) {
registry.add("kafka.bootstrapServers") { kafkaContainer.bootstrapServers }
registry.add("kafka.schemaRegistryUrl") { "localhost:${schemaRegistryContainer.exposedPorts}" }
}
}
我可以看到我的 Kafka 代理正在运行,但是当启动 schema-registry 时,我在 Docker 日志中看到以下错误:
2023-04-06 13:41:04 ==> User
2023-04-06 13:41:04 uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
2023-04-06 13:41:04 ==> Configuring ...
...
(以下省略了一些日志)
...
2023-04-06 13:41:36 org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
2023-04-06 13:41:36 [2023-04-06 11:41:36,929] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected.
2023-04-06 13:41:36 [2023-04-06 11:41:36,929] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available.
...
希望这能帮助您解决问题。
英文:
I am trying to start kafka and schemaregistry in docker containers using my integration tests and Test containers in Kotlin.
Here is my Test containers setup :
@Testcontainers
companion object {
@Container
val kafkaContainer = KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:latest")).apply {
setWaitStrategy(
Wait.defaultWaitStrategy()
.withStartupTimeout(Duration.ofSeconds(75))
)
withEmbeddedZookeeper()
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:9093 ,BROKER://0.0.0.0:9092")
.withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT")
.withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "BROKER")
.withEnv("KAFKA_BROKER_ID", "1")
.withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1")
.withEnv("KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS", "1")
.withEnv("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "1")
.withEnv("KAFKA_TRANSACTION_STATE_LOG_MIN_ISR", "1")
.withEnv("KAFKA_LOG_FLUSH_INTERVAL_MESSAGES", Long.MAX_VALUE.toString())
.withEnv("KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS", "0")
.start()
}.withReuse(true)
@Container
val schemaRegistryContainer = GenericContainer(DockerImageName.parse("confluentinc/cp-schema-registry")).apply {
withExposedPorts(8081)
withEnv("SCHEMA_REGISTRY_HOST_NAME", "schema-registry")
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://localhost:8081")
withEnv("SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS", kafkaContainer.bootstrapServers)
withNetwork(kafkaContainer.network)
start()
}
@DynamicPropertySource
@JvmStatic
fun kafkaProperties(registry: DynamicPropertyRegistry) {
registry.add("kafka.bootstrapServers") { kafkaContainer.bootstrapServers }
registry.add("kafka.schemaRegistryUrl") { "localhost:${schemaRegistryContainer.exposedPorts}" }
}
i can see that my kafka broker is up and running :
enter image description here
So kafka starts first then when schema-registry is starting i see this error in docker logs :
2023-04-06 13:41:04 ===> User
2023-04-06 13:41:04 uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
2023-04-06 13:41:04 ===> Configuring ...
2023-04-06 13:41:05 ===> Running preflight checks ...
2023-04-06 13:41:05 ===> Check if Kafka is healthy ...
2023-04-06 13:41:06 [2023-04-06 11:41:06,161] INFO AdminClientConfig values:
2023-04-06 13:41:06 bootstrap.servers = [PLAINTEXT://localhost:60422]
2023-04-06 13:41:06 client.dns.lookup = use_all_dns_ips
2023-04-06 13:41:06 client.id =
2023-04-06 13:41:06 connections.max.idle.ms = 300000
2023-04-06 13:41:06 default.api.timeout.ms = 60000
2023-04-06 13:41:06 metadata.max.age.ms = 300000
2023-04-06 13:41:06 metric.reporters = []
2023-04-06 13:41:06 metrics.num.samples = 2
2023-04-06 13:41:06 metrics.recording.level = INFO
2023-04-06 13:41:06 metrics.sample.window.ms = 30000
2023-04-06 13:41:06 receive.buffer.bytes = 65536
2023-04-06 13:41:06 reconnect.backoff.max.ms = 1000
2023-04-06 13:41:06 reconnect.backoff.ms = 50
2023-04-06 13:41:06 request.timeout.ms = 30000
2023-04-06 13:41:06 retries = 2147483647
2023-04-06 13:41:06 retry.backoff.ms = 100
2023-04-06 13:41:06 sasl.client.callback.handler.class = null
2023-04-06 13:41:06 sasl.jaas.config = null
2023-04-06 13:41:06 sasl.kerberos.kinit.cmd = /usr/bin/kinit
2023-04-06 13:41:06 sasl.kerberos.min.time.before.relogin = 60000
2023-04-06 13:41:06 sasl.kerberos.service.name = null
2023-04-06 13:41:06 sasl.kerberos.ticket.renew.jitter = 0.05
2023-04-06 13:41:06 sasl.kerberos.ticket.renew.window.factor = 0.8
2023-04-06 13:41:06 sasl.login.callback.handler.class = null
2023-04-06 13:41:06 sasl.login.class = null
2023-04-06 13:41:06 sasl.login.connect.timeout.ms = null
2023-04-06 13:41:06 sasl.login.read.timeout.ms = null
2023-04-06 13:41:06 sasl.login.refresh.buffer.seconds = 300
2023-04-06 13:41:06 sasl.login.refresh.min.period.seconds = 60
2023-04-06 13:41:06 sasl.login.refresh.window.factor = 0.8
2023-04-06 13:41:06 sasl.login.refresh.window.jitter = 0.05
2023-04-06 13:41:06 sasl.login.retry.backoff.max.ms = 10000
2023-04-06 13:41:06 sasl.login.retry.backoff.ms = 100
2023-04-06 13:41:06 sasl.mechanism = GSSAPI
2023-04-06 13:41:06 sasl.oauthbearer.clock.skew.seconds = 30
2023-04-06 13:41:06 sasl.oauthbearer.expected.audience = null
2023-04-06 13:41:06 sasl.oauthbearer.expected.issuer = null
2023-04-06 13:41:06 sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000
2023-04-06 13:41:06 sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000
2023-04-06 13:41:06 sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100
2023-04-06 13:41:06 sasl.oauthbearer.jwks.endpoint.url = null
2023-04-06 13:41:06 sasl.oauthbearer.scope.claim.name = scope
2023-04-06 13:41:06 sasl.oauthbearer.sub.claim.name = sub
2023-04-06 13:41:06 sasl.oauthbearer.token.endpoint.url = null
2023-04-06 13:41:06 security.protocol = PLAINTEXT
2023-04-06 13:41:06 security.providers = null
2023-04-06 13:41:06 send.buffer.bytes = 131072
2023-04-06 13:41:06 socket.connection.setup.timeout.max.ms = 30000
2023-04-06 13:41:06 socket.connection.setup.timeout.ms = 10000
2023-04-06 13:41:06 ssl.cipher.suites = null
2023-04-06 13:41:06 ssl.enabled.protocols = [TLSv1.2, TLSv1.3]
2023-04-06 13:41:06 ssl.endpoint.identification.algorithm = https
2023-04-06 13:41:06 ssl.engine.factory.class = null
2023-04-06 13:41:06 ssl.key.password = null
2023-04-06 13:41:06 ssl.keymanager.algorithm = SunX509
2023-04-06 13:41:06 ssl.keystore.certificate.chain = null
2023-04-06 13:41:06 ssl.keystore.key = null
2023-04-06 13:41:06 ssl.keystore.location = null
2023-04-06 13:41:06 ssl.keystore.password = null
2023-04-06 13:41:06 ssl.keystore.type = JKS
2023-04-06 13:41:06 ssl.protocol = TLSv1.3
2023-04-06 13:41:06 ssl.provider = null
2023-04-06 13:41:06 ssl.secure.random.implementation = null
2023-04-06 13:41:06 ssl.trustmanager.algorithm = PKIX
2023-04-06 13:41:06 ssl.truststore.certificates = null
2023-04-06 13:41:06 ssl.truststore.location = null
2023-04-06 13:41:06 ssl.truststore.password = null
2023-04-06 13:41:06 ssl.truststore.type = JKS
2023-04-06 13:41:06 (org.apache.kafka.clients.admin.AdminClientConfig)
2023-04-06 13:41:06 [2023-04-06 11:41:06,308] INFO Kafka version: 7.3.3-ccs (org.apache.kafka.common.utils.AppInfoParser)
2023-04-06 13:41:06 [2023-04-06 11:41:06,309] INFO Kafka commitId: 37ce202868a57983 (org.apache.kafka.common.utils.AppInfoParser)
2023-04-06 13:41:06 [2023-04-06 11:41:06,309] INFO Kafka startTimeMs: 1680781266306 (org.apache.kafka.common.utils.AppInfoParser)
2023-04-06 13:41:06 [2023-04-06 11:41:06,332] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,335] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,439] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,439] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,540] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,540] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,844] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:06 [2023-04-06 11:41:06,844] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:07 [2023-04-06 11:41:07,249] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:07 [2023-04-06 11:41:07,249] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:08 [2023-04-06 11:41:08,188] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:08 [2023-04-06 11:41:08,189] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:09 [2023-04-06 11:41:09,106] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:09 [2023-04-06 11:41:09,106] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:10 [2023-04-06 11:41:10,218] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:10 [2023-04-06 11:41:10,218] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:11 [2023-04-06 11:41:11,134] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:11 [2023-04-06 11:41:11,135] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:12 [2023-04-06 11:41:12,158] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:12 [2023-04-06 11:41:12,158] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:13 [2023-04-06 11:41:13,066] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:13 [2023-04-06 11:41:13,066] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:14 [2023-04-06 11:41:14,083] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:14 [2023-04-06 11:41:14,083] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:14 [2023-04-06 11:41:14,999] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:14 [2023-04-06 11:41:14,999] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:16 [2023-04-06 11:41:16,121] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:16 [2023-04-06 11:41:16,121] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:17 [2023-04-06 11:41:17,041] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:17 [2023-04-06 11:41:17,041] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:17 [2023-04-06 11:41:17,957] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:17 [2023-04-06 11:41:17,957] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:18 [2023-04-06 11:41:18,871] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:18 [2023-04-06 11:41:18,871] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:20 [2023-04-06 11:41:20,089] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:20 [2023-04-06 11:41:20,089] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:21 [2023-04-06 11:41:21,305] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:21 [2023-04-06 11:41:21,305] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:22 [2023-04-06 11:41:22,319] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:22 [2023-04-06 11:41:22,319] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:23 [2023-04-06 11:41:23,339] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:23 [2023-04-06 11:41:23,339] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:24 [2023-04-06 11:41:24,251] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:24 [2023-04-06 11:41:24,251] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:25 [2023-04-06 11:41:25,268] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:25 [2023-04-06 11:41:25,268] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:26 [2023-04-06 11:41:26,483] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:26 [2023-04-06 11:41:26,483] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:27 [2023-04-06 11:41:27,497] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:27 [2023-04-06 11:41:27,497] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:28 [2023-04-06 11:41:28,620] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:28 [2023-04-06 11:41:28,620] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:29 [2023-04-06 11:41:29,628] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:29 [2023-04-06 11:41:29,628] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:30 [2023-04-06 11:41:30,746] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:30 [2023-04-06 11:41:30,746] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:31 [2023-04-06 11:41:31,959] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:31 [2023-04-06 11:41:31,959] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:32 [2023-04-06 11:41:32,992] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:32 [2023-04-06 11:41:32,992] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:34 [2023-04-06 11:41:34,212] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:34 [2023-04-06 11:41:34,212] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:35 [2023-04-06 11:41:35,128] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:35 [2023-04-06 11:41:35,128] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:36 [2023-04-06 11:41:36,049] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:36 [2023-04-06 11:41:36,049] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:36 [2023-04-06 11:41:36,317] INFO [AdminClient clientId=adminclient-1] Metadata update failed (org.apache.kafka.clients.admin.internals.AdminMetadataManager)
2023-04-06 13:41:36 org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
2023-04-06 13:41:36 [2023-04-06 11:41:36,929] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:36 [2023-04-06 11:41:36,929] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:37 [2023-04-06 11:41:37,844] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:37 [2023-04-06 11:41:37,844] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:38 [2023-04-06 11:41:38,965] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:38 [2023-04-06 11:41:38,965] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:39 [2023-04-06 11:41:39,880] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:39 [2023-04-06 11:41:39,880] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:40 [2023-04-06 11:41:40,800] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:40 [2023-04-06 11:41:40,800] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:41 [2023-04-06 11:41:41,914] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:41 [2023-04-06 11:41:41,914] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:43 [2023-04-06 11:41:43,134] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:43 [2023-04-06 11:41:43,134] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:44 [2023-04-06 11:41:44,258] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:44 [2023-04-06 11:41:44,259] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:45 [2023-04-06 11:41:45,273] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:45 [2023-04-06 11:41:45,273] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:46 [2023-04-06 11:41:46,318] ERROR Error while getting broker list. (io.confluent.admin.utils.ClusterStatus)
2023-04-06 13:41:46 java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listNodes
2023-04-06 13:41:46 at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
2023-04-06 13:41:46 at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
2023-04-06 13:41:46 at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:165)
2023-04-06 13:41:46 at io.confluent.admin.utils.ClusterStatus.isKafkaReady(ClusterStatus.java:147)
2023-04-06 13:41:46 at io.confluent.admin.utils.cli.KafkaReadyCommand.main(KafkaReadyCommand.java:149)
2023-04-06 13:41:46 Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listNodes
2023-04-06 13:41:46 [2023-04-06 11:41:46,422] INFO [AdminClient clientId=adminclient-1] Node -1 disconnected. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:46 [2023-04-06 11:41:46,422] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:60422) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
2023-04-06 13:41:47 [2023-04-06 11:41:47,323] INFO Expected 1 brokers but found only 0. Trying to query Kafka for metadata again ... (io.confluent.admin.utils.ClusterStatus)
2023-04-06 13:41:47 [2023-04-06 11:41:47,323] ERROR Expected 1 brokers but found only 0. Brokers found []. (io.confluent.admin.utils.ClusterStatus)
2023-04-06 13:41:47 Using log4j config /etc/schema-registry/log4j.properties
And the schema-registry container stops after this.
Any help would be much appreciated.
I expect this to start the schema -registry so that I can finally run tests
答案1
得分: 0
我通过将以下部分更改来解决这个错误:
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://localhost:8081")
改为
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://0.0.0.0:8081")
还有
registry.add("kafka.properties.schemaRegistryUrl") { "localhost:${schemaRegistryContainer.firstMappedPort}" }
改为
registry.add("kafka.properties.schemaRegistryUrl") { "http://${schemaRegistryContainer.host}:${schemaRegistryContainer.firstMappedPort}" }
希望对某人有所帮助
英文:
I solved this error by changing
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://localhost:8081")
to
withEnv("SCHEMA_REGISTRY_LISTENERS", "http://0.0.0.0:8081")
Also
registry.add("kafka.properties.schemaRegistryUrl") { "localhost:${schemaRegistryContainer.firstMappedPort}" }
to
registry.add("kafka.properties.schemaRegistryUrl") { "http://${schemaRegistryContainer.host}:${schemaRegistryContainer.firstMappedPort}" }
Hope this helps someone
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论