Restart a Pulsar cluster
You can restart all pods of the cluster. When an exception occurs in a database, you can try to restart it.
note
Restarting a Kafka cluster triggers a concurrent restart and the leader may change after the cluster restarts.
Steps
Restart a cluster.
You can use
kbcli
or create an OpsRequest to restart a cluster.Option 1. (Recommended) Use kbcli
Configure the values of
components
andttlSecondsAfterSucceed
and run the command below to restart a specified cluster.kbcli cluster restart NAME --components="pulsar" \
--ttlSecondsAfterSucceed=30components
describes the component name that needs to be restarted.ttlSecondsAfterSucceed
describes the time to live of an OpsRequest job after the restarting succeeds.
Option 2. Create an OpsRequest
Run the command below to apply the restarting to a cluster.
kubectl apply -f - <<EOF
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: ops-restart
spec:
clusterRef: pulsar
type: Restart
restart:
- componentName: pulsar
EOFValidate the restarting.
Run the command below to check the cluster status to check the restarting status.
kbcli cluster list <name>
Example
kbcli cluster list kafka
>
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
pulsar pulsar pulsar-2.11 Delete Running 19m- STATUS=Restarting: it means the cluster restart is in progress.
- STATUS=Running: it means the cluster has been restarted.