forked from TrackingSoft/Kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_kafka.sh
executable file
·42 lines (33 loc) · 998 Bytes
/
install_kafka.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -eux
MIRROR=https://archive.apache.org/dist/kafka/
VERSION=${1:-0.10.2.2}
if [[ $VERSION == "1.0.0" ]]; then
DIST="kafka_2.11-${VERSION}.tgz"
elif [[ $VERSION == "0.11.0.2" ]]; then
DIST="kafka_2.11-${VERSION}.tgz"
elif [[ $VERSION == "0.10.2.2" ]]; then
DIST="kafka_2.12-${VERSION}.tgz"
elif [[ $VERSION == "0.9.0.1" ]]; then
DIST="kafka_2.11-${VERSION}.tgz"
else
>&2 echo "ERROR: unknown version '${VERSION}'"
exit 1
fi
if [[ ! -d vendor ]]; then
mkdir -p vendor
fi
SOURCE="vendor/${DIST}"
if [[ ! -e $SOURCE ]]; then
if ! wget -O $SOURCE "${MIRROR}/${VERSION}/${DIST}" ; then
rm $SOURCE
exit 1
fi
fi
if [[ -e kafka ]]; then
rm -r kafka
fi
mkdir -p kafka
tar xzf $SOURCE -C kafka --strip-components 1
# fix java options issue: https://stackoverflow.com/questions/36970622/kafka-unrecognized-vm-option-printgcdatestamps
find kafka -name \*.sh -exec sed -i'' 's/-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps//g' {} \;