@@ -16,6 +16,8 @@ usage: bootstrap-cluster.sh
1616 -R default_replication_factor
1717 -a auto_create_topics_enable
1818 -e enable_exporters
19+ -m max-request-size
20+ -f max-partition-fetch-bytes
1921EOF
2022}
2123
@@ -80,6 +82,8 @@ start_kafka() {
8082 local zoo_trust_pass=" $9 "
8183 local default_replication_factor=" ${10} "
8284 local auto_create_topics_enable=" ${11} "
85+ local max-request-size=" ${12} "
86+ local max-partition-fetch-bytes=" ${13} "
8387
8488 servers=" $( kafka_servers " $index " " $nodes " ) "
8589 echo KAFKA_SERVERS=" $servers "
@@ -104,6 +108,8 @@ start_kafka() {
104108 --env JMX_PORT=5555 \
105109 --env KAFKA_CFG_DEFAULT_REPLICATION_FACTOR=$default_replication_factor \
106110 --env KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=$auto_create_topics_enable \
111+ --env KAFKA_CFG_MAX_REQUEST_SIZE=$max -request-size \
112+ --env KAFKA_CFG_MAX_PARTITION_FETCH_BYTES=$max -partition-fetch-bytes \
107113 --network $kafka_network \
108114 -v $kafka_broker_name :/bitnami/kafka \
109115 -v ' kafkacert:/bitnami/kafka/config/certs/' \
@@ -133,7 +139,7 @@ start_jmx_exporter(){
133139 # Substitute container name in jmx config and move it
134140 export container_name=$kafka_broker_name
135141 envsubst < jmxconfig.yml.tmpl > ./jmx/config.yml
136-
142+
137143 # create jmx volume mapping the jmx config file
138144 docker volume create --driver local --name jmx_config_volume --opt type=none --opt device=` pwd` /jmx --opt o=uid=root,gid=root --opt o=bind
139145
@@ -187,6 +193,8 @@ zoo_trust_store_pass=
187193default_replication_factor=
188194auto_create_topics_enable=
189195enable_exporters=
196+ max-request-size=
197+ max-partition-fetch-bytes=
190198
191199while [ " $1 " != " " ]; do
192200 case $1 in
@@ -226,6 +234,12 @@ while [ "$1" != "" ]; do
226234 -a | --auto-create-topics ) shift
227235 auto_create_topics_enable=$1
228236 ;;
237+ -m | --max-request-size ) shift
238+ max-request-size=$1
239+ ;;
240+ -f | --max-partition-fetch-bytes ) shift
241+ max-partition-fetch-bytes=$1
242+ ;;
229243 -e | --enable-exporters ) shift
230244 enable_exporters=$1
231245 ;;
@@ -246,7 +260,7 @@ kill_monitoring
246260kill_kafka
247261create_volume
248262create_network
249- start_kafka " $index " " $nodes " " $image " " $zookeeper_connect " " $external_ip " " $retention_hours " " $kafka_cert_pass " " $zoo_key_store_pass " " $zoo_trust_store_pass " " $default_replication_factor " " $auto_create_topics_enable "
263+ start_kafka " $index " " $nodes " " $image " " $zookeeper_connect " " $external_ip " " $retention_hours " " $kafka_cert_pass " " $zoo_key_store_pass " " $zoo_trust_store_pass " " $default_replication_factor " " $auto_create_topics_enable " " $max -request-size " " $max -partition-fetch-bytes "
250264load_certificates_and_restart
251265
252266if [ " $enable_exporters " == true ]; then
@@ -258,4 +272,4 @@ sleep 30 # wait for 5 seconds to print out docker status
258272docker ps -a
259273docker start kafka_prometheus_exporter
260274sleep 15
261- docker ps -a
275+ docker ps -a
0 commit comments