Stop/Start a Pulsar Cluster
You can stop/start a cluster to save computing resources. When a cluster is stopped, the computing resources of this cluster are released, which means the pods of Kubernetes are released, but the storage resources are reserved. Start this cluster again if you want to restore the cluster resources from the original storage by snapshots.
Stop a cluster
Configure the name of your cluster and run the command below to stop this cluster.
- kbcli
- OpsRequest
- Edit cluster YAML file
kbcli cluster stop mycluster -n demo
Apply an OpsRequest to stop a cluster.
kubectl apply -f - <<EOF
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: ops-stop
namespace: demo
spec:
clusterName: mycluster
type: Stop
EOFConfigure replicas as 0 to delete pods.
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mycluster
namespace: demo
spec:
clusterDefinitionRef: pulsar
clusterVersionRef: pulsar-3.0.2
terminationPolicy: Delete
componentSpecs:
- name: pulsar
componentDefRef: pulsar
disableExporter: true
replicas: 0
......Check the status of the cluster to see whether it is stopped.
- kbcli
- kubectl
kbcli cluster list mycluster -n demo
kubectl get cluster mycluster -n demo
Start a cluster
Configure the name of your cluster and run the command below to start this cluster.
- kbcli
- OpsRequest
- Edit cluster YAML file
kbcli cluster start mycluster -n demo
Apply an OpsRequest to start a cluster.
kubectl apply -f - <<EOF
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: ops-start
namespace: demo
spec:
clusterName: mycluster
type: Start
EOFChange replicas back to the original amount to start this cluster again.
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
name: mycluster
namespace: demo
spec:
clusterDefinitionRef: pulsar
clusterVersionRef: pulsar-3.0.2
terminationPolicy: Delete
componentSpecs:
- name: pulsar
componentDefRef: pulsar
disableExporter: true
replicas: 1
......Check the status of the cluster to see whether it is running again.
- kbcli
- kubectl
kbcli cluster list mycluster -n demo
kubectl get cluster mycluster -n demo