-
Notifications
You must be signed in to change notification settings - Fork 20
/
kafka_setup.sh
44 lines (37 loc) · 1.78 KB
/
kafka_setup.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
43
44
#!/bin/bash -e
### Default properties
export KAFKA_CONF_DIR=$KAFKA_HOME/config
export SERVER_log_dirs=${SERVER_log_dirs:-"$KAFKA_DATA_DIR/logs"}
. ${KAFKA_HOME}/bin/kafka_common_functions.sh
DEBUG=${SETUP_DEBUG:-false}
LOWER=${SETUP_LOWER:-false}
# Server
PREFIX=SERVER_ DEST_FILE=${KAFKA_CONF_DIR}/server.properties env_vars_in_file
# Log4j
PREFIX=LOG4J_ DEST_FILE=${KAFKA_CONF_DIR}/log4j.properties env_vars_in_file
# Consumer
PREFIX=CONSUMER_ DEST_FILE=${KAFKA_CONF_DIR}/consumer.properties env_vars_in_file
# Producer
PREFIX=PRODUCER_ DEST_FILE=${KAFKA_CONF_DIR}/producer.properties env_vars_in_file
# Zookeeper
PREFIX=ZK_ DEST_FILE=${KAFKA_CONF_DIR}/zookeeper.properties env_vars_in_file
# Connect
PREFIX=CONN_CONSOLE_SINK_ DEST_FILE=${KAFKA_CONF_DIR}/connect-console-sink.properties env_vars_in_file
PREFIX=CONN_CONSOLE_SOURCE_ DEST_FILE=${KAFKA_CONF_DIR}/connect-console-source.properties env_vars_in_file
PREFIX=CONN_DISTRIB_ DEST_FILE=${KAFKA_CONF_DIR}/connect-distributed.properties env_vars_in_file
PREFIX=CONN_FILE_SINK_ DEST_FILE=${KAFKA_CONF_DIR}/connect-file-sink.properties env_vars_in_file
PREFIX=CONN_FILE_SOURCE_ DEST_FILE=${KAFKA_CONF_DIR}/connect-file-source.properties env_vars_in_file
PREFIX=CONN_LOG4J_ DEST_FILE=${KAFKA_CONF_DIR}/connect-log4j.properties env_vars_in_file
PREFIX=CONN_STANDALONE_ DEST_FILE=${KAFKA_CONF_DIR}/connect-standalone.properties env_vars_in_file
# Tools log4j
PREFIX=TOOLS_LOG4J_ DEST_FILE=${KAFKA_CONF_DIR}/tools-log4j.properties env_vars_in_file
# Ensure permission on possible mount volumes
for dir in $KAFKA_DATA_DIR $KAFKA_HOME/zookeeper $SERVER_log_dirs; do
if [[ ! -d $dir ]]; then
echo "Creating directory $dir ..."
mkdir -p $dir
else
echo "Ensuring permission for directory $dir ..."
sudo chown -R $KAFKA_USER:$KAFKA_GROUP $dir
fi
done