kafka

Форк
0
52 строки · 2.6 Кб
1
#!/bin/sh
2
# Licensed to the Apache Software Foundation (ASF) under one or more
3
# contributor license agreements.  See the NOTICE file distributed with
4
# this work for additional information regarding copyright ownership.
5
# The ASF licenses this file to You under the Apache License, Version 2.0
6
# (the "License"); you may not use this file except in compliance with
7
# the License.  You may obtain a copy of the License at
8
#
9
#    http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
16

17
# Override this section from the script to include the com.sun.management.jmxremote.rmi.port property.
18
if [ -z "${KAFKA_JMX_OPTS-}" ]; then
19
    export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true \
20
    -Dcom.sun.management.jmxremote.authenticate=false \
21
    -Dcom.sun.management.jmxremote.ssl=false "
22
fi
23

24
# The JMX client needs to be able to connect to java.rmi.server.hostname.
25
# The default for bridged n/w is the bridged IP so you will only be able to connect from another docker container.
26
# For host n/w, this is the IP that the hostname on the host resolves to.
27

28
# If you have more than one n/w configured, hostname -i gives you all the IPs,
29
# the default is to pick the first IP (or network).
30
export KAFKA_JMX_HOSTNAME=${KAFKA_JMX_HOSTNAME:-$(hostname -i | cut -d" " -f1)}
31

32
if [ "${KAFKA_JMX_PORT-}" ]; then
33
    export JMX_PORT=$KAFKA_JMX_PORT
34
    export KAFKA_JMX_OPTS="${KAFKA_JMX_OPTS-} -Djava.rmi.server.hostname=$KAFKA_JMX_HOSTNAME \
35
    -Dcom.sun.management.jmxremote.local.only=false \
36
    -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT \
37
    -Dcom.sun.management.jmxremote.port=$JMX_PORT"
38
fi
39

40
# Invoke the docker wrapper to setup property files and format storage
41
result=$(/opt/kafka/kafka.Kafka setup \
42
      --default-configs-dir /etc/kafka/docker \
43
      --mounted-configs-dir /mnt/shared/config \
44
      --final-configs-dir /opt/kafka/config \
45
      -Dlog4j.configuration=file:/opt/kafka/config/tools-log4j.properties 2>&1) || \
46
      echo $result | grep -i "already formatted" || \
47
      { echo $result && (exit 1) }
48

49
echo "WARNING: THIS IS AN EXPERIMENTAL DOCKER IMAGE RECOMMENDED FOR LOCAL TESTING AND DEVELOPMENT PURPOSES."
50

51
KAFKA_LOG4J_CMD_OPTS="-Dkafka.logs.dir=/opt/kafka/logs/ -Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"
52
exec /opt/kafka/kafka.Kafka start --config /opt/kafka/config/server.properties $KAFKA_LOG4J_CMD_OPTS $KAFKA_JMX_OPTS ${KAFKA_OPTS-}
53

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.