Starting and Stopping Saagie
Starting Saagie
-
Declare the variables that will be used by the scripts exactly as follows:
declare dbs="mongo|postgresql|schema-registry" declare -a statefulsets=("saagie-kafka-cp-zookeeper" "saagie-kafka-cp-kafka")
-
Start Saagie by launching the components in the following order:
-
Start Zookeeper and Kafka, each running three pods.
for statefulset in "${statefulsets[@]}" do echo "Starting $statefulset..." kubectl scale statefulset.apps -n <installationId> $statefulset --replicas=3 done
-
Launch database-related deployments, containing MongoDB, PostgreSQL, and schema-registry.
for db_deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E $dbs | grep -Ev $excludes` do echo "Starting $db_deployment..." kubectl scale deployment.extensions -n <installationId> --replicas 1 $db_deployment done
-
Launch product-related deployments.
for deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -Ev $dbs | grep -Ev $excludes` do echo "Starting $deployment..." kubectl scale deployment.extensions -n <installationId> --replicas 1 $deployment done
Where:
-
<installationId>
must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.
-
Stopping Saagie
When stopping Saagie, some components must be stopped before others to avoid unexpected behaviors. |
-
Declare the variables that will be used by the scripts exactly as follows:
declare dbs="mongo|postgresql|schema-registry" declare -a statefulsets=("saagie-kafka-cp-zookeeper" "saagie-kafka-cp-kafka")
-
Stop Saagie by stopping the components in the following order:
-
Stop product-related deployments.
for deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -Ev $dbs | grep -Ev $excludes` do echo "Shutting down $deployment..." kubectl scale deployment.extensions -n <installationId> --replicas 0 $deployment done
-
Stop database-related deployments.
for db_deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E $dbs | grep -Ev $excludes` do echo "Shutting down $db_deployment..." kubectl scale deployment.extensions -n <installationId> --replicas 0 $db_deployment done
-
Stop Kafka and Zookeeper.
for statefulset in "${statefulsets[@]}" do echo "Shutting down $statefulset..." kubectl scale statefulset.apps -n <installationId> $statefulset --replicas=0 done
Where:
-
<installationId>
must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.
-
Scripts to Start and Stop Saagie
#!/bin/bash
declare dbs="mongo|postgresql|schema-registry"
declare -a statefulsets=("saagie-kafka-cp-zookeeper" "saagie-kafka-cp-kafka")
# Start kafka & zookeeper
for statefulset in "${statefulsets[@]}"
do
echo "Starting $statefulset..."
kubectl scale statefulset.apps -n <installationId> $statefulset --replicas=3
done
# Start every saagie-common databases deployments
for db_deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E $dbs | grep -Ev $excludes`
do
echo "Starting $db_deployment..."
kubectl scale deployment.extensions -n <installationId> --replicas 1 $db_deployment
done
# Start every saagie-common deployments (except databases & schema-registry)
for deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -Ev $dbs | grep -Ev $excludes`
do
echo "Starting $deployment..."
kubectl scale deployment.extensions -n <installationId> --replicas 1 $deployment
done
Where:
-
<installationId>
must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.
#!/bin/bash
declare dbs="mongo|postgresql|schema-registry"
declare -a statefulsets=("saagie-kafka-cp-zookeeper" "saagie-kafka-cp-kafka")
# Stop every saagie-common deployments (except databases & schema-registry)
for deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -Ev $dbs | grep -Ev $excludes`
do
echo "Shutting down $deployment..."
kubectl scale deployment.extensions -n <installationId> --replicas 0 $deployment
done
# Stop every saagie-common databases deployments
for db_deployment in `kubectl get deployment.extensions -n <installationId> -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E $dbs | grep -Ev $excludes`
do
echo "Shutting down $db_deployment..."
kubectl scale deployment.extensions -n <installationId> --replicas 0 $db_deployment
done
# Stop kafka & zookeeper
for statefulset in "${statefulsets[@]}"
do
echo "Shutting down $statefulset..."
kubectl scale statefulset.apps -n <installationId> $statefulset --replicas=0
done
Where:
-
<installationId>
must be replaced with your installation ID. It must match the prefix you have determined for your DNS entry.