Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: when KAFKA_HEAP_OPTS set, this code try to modify read-only /opt/bin/kafka-server-start.sh , then throw ACCESS DENIED and failed to start #657

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions start-kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ if [[ -z "$KAFKA_LOG_DIRS" ]]; then
export KAFKA_LOG_DIRS="/kafka/kafka-logs-$HOSTNAME"
fi

if [[ -n "$KAFKA_HEAP_OPTS" ]]; then
sed -r -i 's/(export KAFKA_HEAP_OPTS)="(.*)"/\1="'"$KAFKA_HEAP_OPTS"'"/g' "$KAFKA_HOME/bin/kafka-server-start.sh"
unset KAFKA_HEAP_OPTS
fi
# When KAFKA_HEAP_OPTS set, this code try to modify read-only /opt/bin/kafka-server-start.sh
# then throw ACCESS DENIED and failed to start because 'bash -e'
# But the script kafka-server-start.sh will apply KAFKA_HEAP_OPTS as well!
# It works fine with version 2.13-2.7.0
#
#if [[ -n "$KAFKA_HEAP_OPTS" ]]; then
# sed -r -i 's/(export KAFKA_HEAP_OPTS)="(.*)"/\1="'"$KAFKA_HEAP_OPTS"'"/g' "$KAFKA_HOME/bin/kafka-server-start.sh"
# unset KAFKA_HEAP_OPTS
#fi

if [[ -n "$HOSTNAME_COMMAND" ]]; then
HOSTNAME_VALUE=$(eval "$HOSTNAME_COMMAND")
Expand Down