我试着和docker一起经营Kafka。我可以运行zookeeper、broker和kafka connect。
在此处输入图像描述
但当我尝试运行ksqldb服务器时,kafka connect停止了。
在此处输入图像描述
这里是我的docker撰写文件:
version: '3.8'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.5.0
hostname: zookeeper
container_name: zookeeper
ports:
- 2181:2181
environment:
- ZOOKEEPER_CLIENT_PORT=2181
- ZOOKEEPER_TICK_TIME=2000
broker:
image: confluentinc/cp-kafka:5.5.0
hostname: broker
container_name: broker
ports:
- 29092:29092
- 9092:9092
environment:
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
depends_on:
- zookeeper
schema-registry:
image: confluentinc/cp-schema-registry:5.5.0
hostname: schema-registry
container_name: schema-registry
ports:
- 8081:8081
environment:
- SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=zookeeper:2181
- SCHEMA_REGISTRY_HOST_NAME=schema-registry
- SCHEMA_REGISTRY_LISTENERS=http://schema-registry:8081
depends_on:
- zookeeper
- broker
connect:
image: confluentinc/cp-kafka-connect:5.5.0
hostname: connect
container_name: connect
ports:
- 8083:8083
volumes:
- mi4:/tmp/
# - $PWD/tmp:/tmp/
environment:
- CONNECT_BOOTSTRAP_SERVERS=broker:29092
- CONNECT_REST_ADVERTISED_HOST_NAME=localhost
- CONNECT_REST_PORT=8083
- CONNECT_GROUP_ID=compose-connect-group
- CONNECT_CONFIG_STORAGE_TOPIC=connect-configs
- CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR=1
- CONNECT_OFFSET_STORAGE_TOPIC=connect-offsets
- CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR=1
- CONNECT_STATUS_STORAGE_TOPIC=connect-statuses
- CONNECT_STATUS_STORAGE_REPLICATION_FACTOR=1
- CONNECT_KEY_CONVERTER= io.confluent.connect.avro.AvroConverter
- CONNECT_VALUE_CONVERTER= io.confluent.connect.avro.AvroConverter
- CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL=http://schema-registry:8081
- CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL=http://schema-registry:8081
- CONNECT_INTERNAL_KEY_CONVERTER= org.apache.kafka.connect.json.JsonConverter
- CONNECT_INTERNAL_VALUE_CONVERTER= org.apache.kafka.connect.json.JsonConverter
- CONNECT_LOG4J_ROOT_LOGLEVEL=INFO
- CONNECT_LOG4J_LOGGERS= org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR
- CONNECT_PLUGIN_PATH=/usr/share/java/
depends_on:
- zookeeper
- broker
- schema-registry
ksqldb-server:
image: confluentinc/cp-ksqldb-server:5.5.0
hostname: ksqldb-server
container_name: ksqldb-server
depends_on:
- broker
- connect
ports:
- 8088:8088
environment:
- KSQL_BOOTSTRAP_SERVERS=broker:29092
- KSQL_CONFIG_DIR=/etc/ksql
- KSQL_HOST_NAME=ksqldb-server
- KSQL_LISTENERS=http://0.0.0.0:8088
- KSQL_AUTO_OFFSET_RESET=earliest
- KSQL_CACHE_MAX_BYTES_BUFFERING=0
- KSQL_KSQL_SCHEMA_REGISTRY_URL=http://schema-registry:8081
- KSQL_PRODUCER_INTERCEPTOR_CLASSES= io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor
- KSQL_CONSUMER_INTERCEPTOR_CLASSES= io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor
- KSQL_KSQL_CONNECT_URL=http://connect:8083
volumes:
mi4:
你知道吗!!
我检查了我的容器的日志,但是没有添加错误信息。
1条答案
按热度按时间ltskdhd11#
我修改了docker设置**
docker内存分配最少为8GB。使用docker desktop for mac时,默认docker内存分配为2 gb。您可以在docker中将默认分配更改为8GB。
**