github.com/pachyderm/pachyderm@v1.13.4/etc/kubernetes-kafka/4kafka/10broker-config.yml (about)

     1  kind: ConfigMap
     2  metadata:
     3    name: broker-config
     4    namespace: kafka
     5  apiVersion: v1
     6  data:
     7    init.sh: |-
     8      #!/bin/bash
     9      set -e
    10      set -x
    11      cp /etc/kafka-configmap/log4j.properties /etc/kafka/
    12  
    13      KAFKA_BROKER_ID=${HOSTNAME##*-}
    14      SEDS=("s/#init#broker.id=#init#/broker.id=$KAFKA_BROKER_ID/")
    15      LABELS="kafka-broker-id=$KAFKA_BROKER_ID"
    16      ANNOTATIONS=""
    17  
    18      hash kubectl 2>/dev/null || {
    19        SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# kubectl not found in path/")
    20      } && {
    21        ZONE=$(kubectl get node "$NODE_NAME" -o=go-template='{{index .metadata.labels "failure-domain.beta.kubernetes.io/zone"}}')
    22        if [ "x$ZONE" == "x<no value>" ]; then
    23          SEDS+=("s/#init#broker.rack=#init#/#init#broker.rack=# zone label not found for node $NODE_NAME/")
    24        else
    25          SEDS+=("s/#init#broker.rack=#init#/broker.rack=$ZONE/")
    26          LABELS="$LABELS kafka-broker-rack=$ZONE"
    27        fi
    28  
    29        OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
    30        OUTSIDE_PORT=3240${KAFKA_BROKER_ID}
    31        SEDS+=("s|#init#advertised.listeners=OUTSIDE://#init#|advertised.listeners=OUTSIDE://${OUTSIDE_HOST}:${OUTSIDE_PORT}|")
    32        ANNOTATIONS="$ANNOTATIONS kafka-listener-outside-host=$OUTSIDE_HOST kafka-listener-outside-port=$OUTSIDE_PORT"
    33  
    34        if [ ! -z "$LABELS" ]; then
    35          kubectl -n $POD_NAMESPACE label pod $POD_NAME $LABELS || echo "Failed to label $POD_NAMESPACE.$POD_NAME - RBAC issue?"
    36        fi
    37        if [ ! -z "$ANNOTATIONS" ]; then
    38          kubectl -n $POD_NAMESPACE annotate pod $POD_NAME $ANNOTATIONS || echo "Failed to annotate $POD_NAMESPACE.$POD_NAME - RBAC issue?"
    39        fi
    40      }
    41      printf '%s\n' "${SEDS[@]}" | sed -f - /etc/kafka-configmap/server.properties > /etc/kafka/server.properties.tmp
    42      [ $? -eq 0 ] && mv /etc/kafka/server.properties.tmp /etc/kafka/server.properties
    43  
    44    server.properties: |-
    45      ############################# Log Basics #############################
    46  
    47      # A comma seperated list of directories under which to store log files
    48      # Overrides log.dir
    49      log.dirs=/var/lib/kafka/data/topics
    50  
    51      # The default number of log partitions per topic. More partitions allow greater
    52      # parallelism for consumption, but this will also result in more files across
    53      # the brokers.
    54      num.partitions=12
    55  
    56      default.replication.factor=3
    57  
    58      min.insync.replicas=2
    59  
    60      auto.create.topics.enable=false
    61  
    62      # The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
    63      # This value is recommended to be increased for installations with data dirs located in RAID array.
    64      #num.recovery.threads.per.data.dir=1
    65  
    66      ############################# Server Basics #############################
    67  
    68      # The id of the broker. This must be set to a unique integer for each broker.
    69      #init#broker.id=#init#
    70  
    71      #init#broker.rack=#init#
    72  
    73      ############################# Socket Server Settings #############################
    74  
    75      # The address the socket server listens on. It will get the value returned from 
    76      # java.net.InetAddress.getCanonicalHostName() if not configured.
    77      #   FORMAT:
    78      #     listeners = listener_name://host_name:port
    79      #   EXAMPLE:
    80      #     listeners = PLAINTEXT://your.host.name:9092
    81      #listeners=PLAINTEXT://:9092
    82      listeners=OUTSIDE://:9094,PLAINTEXT://:9092
    83  
    84      # Hostname and port the broker will advertise to producers and consumers. If not set, 
    85      # it uses the value for "listeners" if configured.  Otherwise, it will use the value
    86      # returned from java.net.InetAddress.getCanonicalHostName().
    87      #advertised.listeners=PLAINTEXT://your.host.name:9092
    88      #init#advertised.listeners=OUTSIDE://#init#,PLAINTEXT://:9092
    89  
    90      # Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
    91      #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
    92      listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL,OUTSIDE:PLAINTEXT
    93      inter.broker.listener.name=PLAINTEXT
    94  
    95      # The number of threads that the server uses for receiving requests from the network and sending responses to the network
    96      #num.network.threads=3
    97  
    98      # The number of threads that the server uses for processing requests, which may include disk I/O
    99      #num.io.threads=8
   100  
   101      # The send buffer (SO_SNDBUF) used by the socket server
   102      #socket.send.buffer.bytes=102400
   103  
   104      # The receive buffer (SO_RCVBUF) used by the socket server
   105      #socket.receive.buffer.bytes=102400
   106  
   107      # The maximum size of a request that the socket server will accept (protection against OOM)
   108      #socket.request.max.bytes=104857600
   109  
   110      ############################# Internal Topic Settings  #############################
   111      # The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
   112      # For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3.
   113      #offsets.topic.replication.factor=1
   114      #transaction.state.log.replication.factor=1
   115      #transaction.state.log.min.isr=1
   116  
   117      ############################# Log Flush Policy #############################
   118  
   119      # Messages are immediately written to the filesystem but by default we only fsync() to sync
   120      # the OS cache lazily. The following configurations control the flush of data to disk.
   121      # There are a few important trade-offs here:
   122      #    1. Durability: Unflushed data may be lost if you are not using replication.
   123      #    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
   124      #    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.
   125      # The settings below allow one to configure the flush policy to flush data after a period of time or
   126      # every N messages (or both). This can be done globally and overridden on a per-topic basis.
   127  
   128      # The number of messages to accept before forcing a flush of data to disk
   129      #log.flush.interval.messages=10000
   130  
   131      # The maximum amount of time a message can sit in a log before we force a flush
   132      #log.flush.interval.ms=1000
   133  
   134      ############################# Log Retention Policy #############################
   135  
   136      # The following configurations control the disposal of log segments. The policy can
   137      # be set to delete segments after a period of time, or after a given size has accumulated.
   138      # A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
   139      # from the end of the log.
   140  
   141      # https://cwiki.apache.org/confluence/display/KAFKA/KIP-186%3A+Increase+offsets+retention+default+to+7+days
   142      offsets.retention.minutes=10080
   143  
   144      # The minimum age of a log file to be eligible for deletion due to age
   145      log.retention.hours=-1
   146  
   147      # A size-based retention policy for logs. Segments are pruned from the log unless the remaining
   148      # segments drop below log.retention.bytes. Functions independently of log.retention.hours.
   149      #log.retention.bytes=1073741824
   150  
   151      # The maximum size of a log segment file. When this size is reached a new log segment will be created.
   152      #log.segment.bytes=1073741824
   153  
   154      # The interval at which log segments are checked to see if they can be deleted according
   155      # to the retention policies
   156      #log.retention.check.interval.ms=300000
   157  
   158      ############################# Zookeeper #############################
   159  
   160      # Zookeeper connection string (see zookeeper docs for details).
   161      # This is a comma separated host:port pairs, each corresponding to a zk
   162      # server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
   163      # You can also append an optional chroot string to the urls to specify the
   164      # root directory for all kafka znodes.
   165      zookeeper.connect=zookeeper:2181
   166  
   167      # Timeout in ms for connecting to zookeeper
   168      #zookeeper.connection.timeout.ms=6000
   169  
   170  
   171      ############################# Group Coordinator Settings #############################
   172  
   173      # The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
   174      # The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.
   175      # The default value for this is 3 seconds.
   176      # We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
   177      # However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.
   178      #group.initial.rebalance.delay.ms=0
   179  
   180    log4j.properties: |-
   181      # Unspecified loggers and loggers with additivity=true output to server.log and stdout
   182      # Note that INFO only applies to unspecified loggers, the log level of the child logger is used otherwise
   183      log4j.rootLogger=INFO, stdout
   184  
   185      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
   186      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
   187      log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
   188  
   189      log4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender
   190      log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
   191      log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
   192      log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
   193      log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   194  
   195      log4j.appender.stateChangeAppender=org.apache.log4j.DailyRollingFileAppender
   196      log4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH
   197      log4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log
   198      log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout
   199      log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   200  
   201      log4j.appender.requestAppender=org.apache.log4j.DailyRollingFileAppender
   202      log4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH
   203      log4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log
   204      log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
   205      log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   206  
   207      log4j.appender.cleanerAppender=org.apache.log4j.DailyRollingFileAppender
   208      log4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH
   209      log4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log
   210      log4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout
   211      log4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   212  
   213      log4j.appender.controllerAppender=org.apache.log4j.DailyRollingFileAppender
   214      log4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH
   215      log4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log
   216      log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout
   217      log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   218  
   219      log4j.appender.authorizerAppender=org.apache.log4j.DailyRollingFileAppender
   220      log4j.appender.authorizerAppender.DatePattern='.'yyyy-MM-dd-HH
   221      log4j.appender.authorizerAppender.File=${kafka.logs.dir}/kafka-authorizer.log
   222      log4j.appender.authorizerAppender.layout=org.apache.log4j.PatternLayout
   223      log4j.appender.authorizerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
   224  
   225      # Change the two lines below to adjust ZK client logging
   226      log4j.logger.org.I0Itec.zkclient.ZkClient=INFO
   227      log4j.logger.org.apache.zookeeper=INFO
   228  
   229      # Change the two lines below to adjust the general broker logging level (output to server.log and stdout)
   230      log4j.logger.kafka=INFO
   231      log4j.logger.org.apache.kafka=INFO
   232  
   233      # Change to DEBUG or TRACE to enable request logging
   234      log4j.logger.kafka.request.logger=WARN, requestAppender
   235      log4j.additivity.kafka.request.logger=false
   236  
   237      # Uncomment the lines below and change log4j.logger.kafka.network.RequestChannel$ to TRACE for additional output
   238      # related to the handling of requests
   239      #log4j.logger.kafka.network.Processor=TRACE, requestAppender
   240      #log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender
   241      #log4j.additivity.kafka.server.KafkaApis=false
   242      log4j.logger.kafka.network.RequestChannel$=WARN, requestAppender
   243      log4j.additivity.kafka.network.RequestChannel$=false
   244  
   245      log4j.logger.kafka.controller=TRACE, controllerAppender
   246      log4j.additivity.kafka.controller=false
   247  
   248      log4j.logger.kafka.log.LogCleaner=INFO, cleanerAppender
   249      log4j.additivity.kafka.log.LogCleaner=false
   250  
   251      log4j.logger.state.change.logger=TRACE, stateChangeAppender
   252      log4j.additivity.state.change.logger=false
   253  
   254      # Change to DEBUG to enable audit log for the authorizer
   255      log4j.logger.kafka.authorizer.logger=WARN, authorizerAppender
   256      log4j.additivity.kafka.authorizer.logger=false