forked from dunwu/linux-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkafka-install.sh
More file actions
34 lines (26 loc) · 899 Bytes
/
kafka-install.sh
File metadata and controls
34 lines (26 loc) · 899 Bytes
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
#!/usr/bin/env bash
cat << EOF
###################################################################################
# 安装 Kafka 脚本
# @system: 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
EOF
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]];then
echo "Usage: sh kafka-install.sh [version] [path]"
echo -e "Example: sh kafka-install.sh 2.2.0 /opt/kafka\n"
fi
version=2.2.0
if [[ -n $1 ]]; then
version=$1
fi
root=/opt/kafka
if [[ -n $2 ]]; then
root=$2
fi
echo "Current execution: install kafka ${version} to ${root}"
echo -e "\n>>>>>>>>> download kafka"
mkdir -p ${root}
wget -O ${root}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz
echo -e "\n>>>>>>>>> install kafka"
tar zxf ${root}/kafka_2.12-${version}.tgz -C ${root}