Skip to content

Commit

Permalink
rpm: update connection settings for kafka server
Browse files Browse the repository at this point in the history
* kafka-topic must use --bootstrap-server instead of --zookeeper

Signed-off-by: Kentaro Hayashi <kenhys@gmail.com>
  • Loading branch information
kenhys committed Jul 31, 2023
1 parent 1ac7979 commit 853e271
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fluent-package/yum/serverspec-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,23 @@ EOF
exit 1
fi
done
# Allow connection to kafka server
echo "listeners=PLAINTEXT://localhost:9092" | tee -a /etc/kafka/server.properties
/usr/bin/kafka-server-start /etc/kafka/server.properties &
n=1
while true ; do
sleep 1
status=$(/usr/bin/zookeeper-shell localhost:2181 ls /brokers/ids | sed -n 6p)
if [ "$status" = "[0]" ]; then
status=$(/usr/bin/kafka-topics --bootstrap-server localhost:9092 --list)
if [ "$status" = "" ]; then
break
fi
n=$((n + 1))
if [ $n -ge $N_POLLING ]; then
echo "failed to get response from kafka-server"
echo "failed to get list of topics from kafka-server"
exit 1
fi
done
/usr/bin/kafka-topics --create --bootstrap-server localhost:2181 --replication-factor 1 --partitions 1 --topic test
/usr/bin/kafka-topics --bootstrap-server localhost:9092 --topic test --create --replication-factor 1 --partitions 1
/usr/sbin/fluentd -c /fluentd/serverspec/test.conf &
fi
export PATH=/opt/fluent/bin:$PATH
Expand Down

0 comments on commit 853e271

Please sign in to comment.