/usr/local/bin/dub path /var/lib/zookeeper/data writable [编辑]

xzabzqsa  于 12个月前  发布在  Apache
关注(0)|答案(1)|浏览(165)

各位,我有个问题。我想通过docker-compose创建两个容器,zookeeper和Kafka。我是这样做的:

version: '3'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:latest
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
    volumes:
      - /srv/zookeeper_data:/var/lib/zookeeper/data
      - /srv/zookeeper_log:/var/lib/zookeeper/log

  kafka:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
      KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092,PLAINTEXT://192.168.100.9:9092"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - /srv/kafka_data:/var/lib/kafka/data

字符串
执行docker-compose build和docker-compose up时,我在控制台中看到错误:

zookeeper_1         | ===> Running preflight checks ...
zookeeper_1         | ===> Check if /var/lib/zookeeper/data is writable ...
zookeeper_1         | Command [/usr/local/bin/dub path /var/lib/zookeeper/data writable] FAILED !
zookeeper_1 exited with code 1
kafka_1             | ===> Running preflight checks ...
kafka_1             | ===> Check if /var/lib/kafka/data is writable ...


上面说了这么多,目录srv/Kafka_datasrv/zookeeper_datasrv/zookeeper_log都存在,怎么办?

w80xi6nr

w80xi6nr1#

我通过将卷路径更改为:

zookeeper:
    image: confluentinc/cp-zookeeper:latest
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
    volumes:
      - zookeeper-data:/var/lib/zookeeper/data
      - zookeeper-log:/var/lib/zookeeper/log

  kafka:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
      KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://192.168.100.9:9092"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - kafka-data:/var/lib/kafka/data
volumes:
  zookeeper-data:
  zookeeper-log:
  kafka-data:

字符串

相关问题