kubernetes中的最大请求大小kafka

axzmvihb  于 2021-06-06  发布在  Kafka
关注(0)|答案(1)|浏览(352)

我想把max.request.size给Kafka在库伯内茨,好像不行。怎么做?
我也试过了 KAFKA_MAX_REQUEST_SIZE 同样没有正面结果:

spec:
  containers:
  - name: kafka
    image: wurstmeister/kafka
    ...

    env:
    - name: KAFKA_ZOOKEEPER_CONNECT
      value: "zookeeper:2181"
    - name: KAFKA_ADVERTISED_PORT
      value: "9092"
    - name: KAFKA_DELETE_TOPIC_ENABLE
      value: "true"
    - name: KAFKA_CREATE_TOPICS
      value: "tpinput:1:1,tpoutput:1:1,operinput:1:1,operoutput:1:1,authoutput:1:1"  
    - name: KAFKA_JMX_PORT
      value: "7071"             
    - name: KAFKA_ZOOKEEPER_TIMEOUT_MS
      value: "16000"
    - name: KAFKA_MESSAGE_MAX_BYTES
      value: "209715200"
    - name: KAFKA_FETCH_MESSAGE_MAX_BYTES
      value: "209715200"  
    - name: KAFKA_REPLICA_FETCH_MAX_BYTES
      value: "209715200" 
    - name: KAFKA_PRODUCER_MAX_REQUEST_SIZE
      value: "9651322321"
    - name: KAFKA_ADVERTISED_HOST_NAME
      valueFrom:
        fieldRef:
          fieldPath: status.podIP        
    - name: KUBE_POD_NAME
      valueFrom:
        fieldRef:
          fieldPath: metadata.name
    imagePullPolicy: Always
    restartPolicy: Always
    envFrom:
    - configMapRef:
        name: env-config-for-pods
k10s72fa

k10s72fa1#

基于此处的docker入口点脚本和该文件中的此部分:

EXCLUSIONS="|KAFKA_VERSION|KAFKA_HOME|KAFKA_DEBUG|KAFKA_GC_LOG_OPTS|KAFKA_HEAP_OPTS|KAFKA_JMX_OPTS|KAFKA_JVM_PERFORMANCE_OPTS|KAFKA_LOG|KAFKA_OPTS|"

# Read in env as a new-line separated array. This handles the case of env variables have spaces and/or carriage returns. See #313

IFS=$'\n'
for VAR in $(env)
do
    env_var=$(echo "$VAR" | cut -d= -f1)
    if [[ "$EXCLUSIONS" = *"|$env_var|"* ]]; then
        echo "Excluding $env_var from broker config"
        continue
    fi

    if [[ $env_var =~ ^KAFKA_ ]]; then
        kafka_name=$(echo "$env_var" | cut -d_ -f2- | tr '[:upper:]' '[:lower:]' | tr _ .)
        updateConfig "$kafka_name" "${!env_var}" "$KAFKA_HOME/config/server.properties"
    fi

    if [[ $env_var =~ ^LOG4J_ ]]; then
        log4j_name=$(echo "$env_var" | tr '[:upper:]' '[:lower:]' | tr _ .)
        updateConfig "$log4j_name" "${!env_var}" "$KAFKA_HOME/config/log4j.properties"
    fi
done
``` `KAFKA_MAX_REQUEST_SIZE` 应该包括在 `$KAFKA_HOME/config/server.properties` 文件为 `max.request.size` . 如果docker图像中有bug,我也不会感到惊讶。
你可以随时进入你的Kafka荚和检查 `$KAFKA_HOME/config/server.properties` 配置文件。

kubectl exec -it -c sh

相关问题