Stop/Start GoldenGate Microservices DistPath with REST API

Here is an example how to stop and start the Distribution Services in GoldenGate Microservices using a REST API.

#!/bin/bash
export NOW=$(date +"%F_%H%M%S")
export OGG_VAR_HOME=/u02/deployments/SRC-PROD-EBS-VCP/var
export OGG_DEPLOYMENT_BASE=/u02/deployments/SRC-PROD-EBS-VCP
export OGG_SSL_HOM=/u02/deployments/SRC-PROD-EBS-VCP/etc/ssl
export OGG_DATA_HOME=/u02/trails/SRC-PROD-EBS-VCP
export OGG_CONF_HOME=/u02/deployments/SRC-PROD-EBS-VCP/etc/conf
export OGG_HOME=/u01/app/ogg/ogg_19c
export OGG_ETC_HOME=/u02/deployments/SRC-PROD-EBS-VCP/etc

logcount=`ls -l ${OGG_CONF_HOME}/ogg/scripts/*.log | wc -l | awk '{ print $1 + 1}'`

export LOG_FILE=${OGG_CONF_HOME}/ogg/scripts/${logcount}_DISTPATH_BOUND_${NOW}.log

## Check DistPath Service Status
curl -u oggadmin:"xxx&" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X GET http://local:9000/services/v2/deployments/SRC-PROD-EBS-VCP/services/distsrvr  | python -m json.tool >> ${LOG_FILE}

## Stop DistPath Service
curl -u oggadmin:"xxx&" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"status": "stopped","enabled": false}' \
-X PATCH http://local:9000/services/v2/deployments/SRC-PROD-EBS-VCP/services/distsrvr | python -m json.tool >> ${LOG_FILE}

sleep 60

## Check DistPath Service Status
curl -u oggadmin:"xxx&" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X GET http://local:9000/services/v2/deployments/SRC-PROD-EBS-VCP/services/distsrvr  | python -m json.tool >> ${LOG_FILE}

##  Start DistPath Service
curl -u oggadmin:"xxx&" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"status": "running","enabled": true}' \
-X PATCH http://local:9000/services/v2/deployments/SRC-PROD-EBS-VCP/services/distsrvr | python -m json.tool >> ${LOG_FILE}

sleep 5

## Check DistPath Service Status
curl -u oggadmin:"xxx" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X GET http://local:9000/services/v2/deployments/SRC-PROD-EBS-VCP/services/distsrvr  | python -m json.tool >> ${LOG_FILE}

cat ${LOG_FILE}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.