master
Vyacheslav Boyko 2019-07-05 12:02:20 +03:00
parent d3e3e714c8
commit 0305cdfd7f
9 changed files with 113 additions and 0 deletions

15
describe-group.sh 100644
View File

@ -0,0 +1,15 @@
#!/bin/bash
KAFKA_IP=`. get-kafka-ip.sh`
if [[ -z "$KAFKA_IP" ]]; then
echo "Could not detect Kafka IP from config/properties"
exit
fi
if [[ -z "$1" ]]; then
echo "No group is provided"
exit
fi
bin/kafka-consumer-groups.sh --bootstrap-server $KAFKA_IP --group $1 --describe

3
get-kafka-ip.sh 100644
View File

@ -0,0 +1,3 @@
#!/bin/bash
cat config/server.properties | grep '^listeners' | sed -e 's/\/\///; s/PLAINTEXT//; s/listeners=//;' | awk -F ":" '{if (NF==3) {print $2":"$3} else {print $1":"$2} }'

View File

@ -0,0 +1,18 @@
#!/bin/bash
KAFKA_IP=`. get-kafka-ip.sh`
if [[ -z "$KAFKA_IP" ]]; then
echo "Could not detect Kafka IP from config/properties"
exit
fi
if [[ -z "$1" ]]; then
echo "No topic is provided";
exit;
fi
echo "If you see nothing for about 5-10 seconds - the topic content is empty."
echo "Press Ctrl^C to exit"
bin/kafka-console-consumer.sh --bootstrap-server $KAFKA_IP --topic $1 --from-beginning

11
list-groups.sh 100644
View File

@ -0,0 +1,11 @@
#!/bin/bash
KAFKA_IP=`. get-kafka-ip.sh`
if [[ -z "$KAFKA_IP" ]]; then
echo "Could not detect Kafka IP from config/properties"
exit
fi
bin/kafka-consumer-groups.sh --bootstrap-server $KAFKA_IP --list

6
start-kafka.sh 100644
View File

@ -0,0 +1,6 @@
#!/bin/bash
KAFKA_LOG=`pwd`/logs/kafka.log
echo $KAFKA_LOG
nohup bin/kafka-server-start.sh config/server.properties > $KAFKA_LOG &

View File

@ -0,0 +1,5 @@
#!/bin/bash
ZOO_LOGS=`pwd`/logs/zookeeper.log
nohup bin/zookeeper-server-start.sh config/zookeeper.properties > $ZOO_LOGS &

27
stop-kafka.sh 100644
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SIGNAL=${SIGNAL:-TERM}
#PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}')
#boyko_vn:
PIDS=$(ps ax | grep java | grep kafka | grep -v zookeeper | grep -v grep | awk '{ print $1}')
if [ -z "$PIDS" ]; then
echo "No kafka server to stop"
exit 1
else
kill -s $SIGNAL $PIDS
fi

27
stop-zookeeper.sh 100644
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SIGNAL=${SIGNAL:-TERM}
#PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}')
#boyko_vn
PIDS=$(ps ax | grep java | grep kafka | grep zookeeper | grep -v grep | awk '{ print $1}')
if [ -z "$PIDS" ]; then
echo "No zookeeper server to stop"
exit 1
else
kill -s $SIGNAL $PIDS
fi

1
which-kafka.sh 100644
View File

@ -0,0 +1 @@
ps ax | grep kafka | grep -v zookeeper | grep -v grep