出于软件测试的目的,我需要在单个docker容器中与应用程序一起运行kafka和zookeeper。我知道我可以将所有组件放入不同的容器中,但这对我的用例来说既不理想也不实用。我有一个脚本,该脚本启动zookeeper,然后启动kafka,然后启动要测试的应用程序。在VM上运行良好。在容器上,zookeeper启动良好,但是kafka既不出现也不发出错误消息。 kafka-server-start.sh脚本只是默默终止,而不会留下活动的kafka实例。
这是一次测试的示例:
lapply(list.files(path), tryCatch(ee, error=function(e) NULL)))
当我手动启动该操作(在Zookeeper已经运行)时会发生这种情况:
===============================================================================
[sndrcv_kafka.sh]: Create kafka/zookeeper instance and static topic
Creating dependency cache dir /worker/rsyslog_docker-ubuntu18-san_rsyslog/build/tests/.dep_cache
Downloading zookeeper
Downloading kafka
Kafka work-dir /worker/rsyslog_docker-ubuntu18-san_rsyslog/build/tests/.dep_wrk/kafka does not exist, no action needed
Creating dependency working directory
Starting Zookeeper instance
ZooKeeper JMX enabled by default
Using config: /worker/rsyslog_docker-ubuntu18-san_rsyslog/build/tests/.dep_wrk/zk/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
Starting Kafka instance kafka-server.properties
Starting Kafka instance kafka-server.properties, SECOND ATTEMPT!
Failed to start Kafka instance for kafka-server.properties
SKIP sndrcv_kafka.sh (exit status: 77)
这在许多发行版和版本上都有再现,因此似乎与docker相关。
有人知道该如何解决吗?或至少如何获得错误消息?