zoukankan      html  css  js  c++  java
  • dockercompose配置带密码验证的kafka

    version: "3"
    
    services:
    
      zookeeper:
        image: wurstmeister/zookeeper
        hostname: zookeeper_sasl
        container_name: zookeeper_sasl
        restart: always
        ports:
          - 32182:2181
        environment:
          ZOOKEEPER_CLIENT_PORT: 2181
          SERVER_JVMFLAGS: -Djava.security.auth.login.config=/opt/zookeeper-3.4.13/secrets/server_jaas.conf
        volumes:
          - /home/tool/kafka-sasl/conf:/opt/zookeeper-3.4.13/conf
          - /home/tool/kafka-sasl/conf/:/opt/zookeeper-3.4.13/secrets/ 
    
    
      kafka:
        image: wurstmeister/kafka:2.11-0.11.0.3
        restart: always
        hostname: broker
        container_name: kafka_sasl
        depends_on:
          - zookeeper
        ports:
          - 59091:9092
        environment:
          KAFKA_BROKER_ID: 0
          KAFKA_ADVERTISED_LISTENERS: SASL_PLAINTEXT://10.18.104.202:59091
          KAFKA_ADVERTISED_PORT: 59091 
          KAFKA_LISTENERS: SASL_PLAINTEXT://0.0.0.0:9092
          KAFKA_SECURITY_INTER_BROKER_PROTOCOL: SASL_PLAINTEXT
          KAFKA_PORT: 59091 
          KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
          KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
          KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer
          KAFKA_SUPER_USERS: User:admin
          KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true" #设置为true,ACL机制为黑名单机制,只有黑名单中的用户无法访问,默认为false,ACL机制为白名单机制,只有白名单中的用户可以访问
          KAFKA_ZOOKEEPER_CONNECT: zookeeper_sasl:2181
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
          KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
          KAFKA_OPTS: -Djava.security.auth.login.config=/opt/kafka/secrets/server_jaas.conf
        volumes:
          - /home/tool/kafka-sasl/conf/:/opt/kafka/secrets/

    配合第一篇文章的conf文件夹里的配置文件使用

  • 相关阅读:
    子网掩码
    一个正则表达式:该正则表达式标示了后面有数字,但又不能是某特定数字的情况
    C++:STL标准入门汇总
    SOAP
    uva10236The Fibonacci Primes
    uvalive3209City Game
    uvalive3695Distant Galaxy
    uva11549Calculator Conundrum
    uva11078Open Credit System
    uvalive3295Counting Triangles
  • 原文地址:https://www.cnblogs.com/zhouj850/p/15683605.html
Copyright © 2011-2022 走看看