尝试在docker容器中使用Testcontainers启动kafka, Schema注册表



我正在尝试使用Kotlin中的集成测试和测试容器在docker容器中启动kafka和schemareregistry。

这是我的测试容器设置:

@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代理已经启动并运行:输入图片描述

所以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: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

模式注册表容器在此之后停止。如有任何帮助,不胜感激。

我希望这将启动schema -registry,以便我最终可以运行测试

我通过修改

解决了这个错误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}" }

希望这能帮助到一些人:)

相关内容

  • 没有找到相关文章

最新更新