Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
443 views
in Technique[技术] by (71.8m points)

apache kafka - How to shutdown running Confluent Cloud cluster?

On Confluent (https://confluent.cloud) there does not appear to be an option to shutdown a Kafka cluster :

enter image description here

I'm attempting to limit my costs and shutdown the cluster. I've explored the various options in the screenshot above but I've not found the location where a cluster can be shutdown.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I believe there's no such option from the Confluent control panel; An option would be using the Confluent Command Line Interface (Confluent CLI).

On previous versions, the command to use was:

confluent stop

With newer versions, I believe the only option to stop the cluster bya CLI is using the confluent local command; The issue is:

The confluent local commands are intended for a single-node development environment and are not suitable for a production environment.

If this is the case, you could stop the broker by calling:

confluent local services kafka stop

Or all the services running from the Confluent platform by:

confluent local services stop


This may be due to security issues, in order to avoid stopping a deployment cluster by incorrectly hitting the wrong button. So the option to stop a deployment cluster is relied to manually stop each broker (f.e, by calling kafka-server-stop.sh), without a GUI or command line help. I know this answer may not help at all, but hope it was informative somehow.


Edit - from the Confluent Kafka Rest Proxy repo -

The way to bind the Rest proxy with the Confluent Cloud is explained here: link the Rest proxy with the Confluent Cloud. If you were able to do so, you may invoke its stop script in order to be propragated to the cloud's brokers instances, even if the docummented clients for the bind are just consumer, producer, and admin

Deployment

The REST proxy includes a built-in Jetty server. The wrapper scripts bin/kafka-rest-start and bin/kafka-rest-stop are the recommended method of starting and stopping the service.

This is the content of the /bin/kafka-rest-stop script:

exec $(dirname $0)/kafka-rest-stop-service '(kafkarest.Main)|(kafkarest.KafkaRestMain)'

Which calls the kafka-rest-stop-service script:

TARGET=`ps ax | egrep -i "$1" | grep java | grep -v grep | awk '{print $1}'`
if [ "x$TARGET" = "x" ]; then
  >&2 echo "No running instance found."
  exit 1
fi

kill "$TARGET"
for i in `seq 20`; do
  sleep 0.25
  ps ax | egrep -i "$1" | grep "$TARGET" > /dev/null
  if [ $? -eq 0 ]; then
    exit 0
  fi
done

>&2 echo "Tried to kill $TARGET but never saw it die"
exit 1

It essentialy sends a SIGTERM signal to the process, by calling kill "$TARGET"

So the REST API may allow you to stop the entire cluster, by calling the wrapped stop script. Unfortunatelly, I couldn't find further info about this command or the syntax to call it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...