-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customers have complained that the deployment procedures of CBDB is tedious. In this commit, gpdemo provides a default configuration to enable a one-click deployment experience. The default parameters are the same as "make create-demo-cluster".
- Loading branch information
1 parent
5a6cac3
commit e221d14
Showing
7 changed files
with
154 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
USAGE() { | ||
echo "" | ||
echo " `basename $0` {-c | -d | -h} <-K>" | ||
echo " -c : Check if demo is possible." | ||
echo " -d : Delete the demo." | ||
echo " -K : Create cluster without data checksums." | ||
echo " -h : Usage, prints this message." | ||
echo "" | ||
} | ||
|
||
PORT_BASE=${PORT_BASE:=7000} | ||
NUM_PRIMARY_MIRROR_PAIRS=${NUM_PRIMARY_MIRROR_PAIRS:=3} | ||
if [ "${NUM_PRIMARY_MIRROR_PAIRS}" -eq "0" ]; then | ||
BLDWRAP_POSTGRES_CONF_ADDONS="fsync=on ${BLDWRAP_POSTGRES_CONF_ADDONS}" # always enable fsync if singlenode | ||
fi | ||
if [[ ! ${BLDWRAP_POSTGRES_CONF_ADDONS} == *"fsync=on"* ]]; then | ||
BLDWRAP_POSTGRES_CONF_ADDONS="fsync=off ${BLDWRAP_POSTGRES_CONF_ADDONS}" # only append fsync=off if it doesn't contains fsync=on | ||
else | ||
BLDWRAP_POSTGRES_CONF_ADDONS="${BLDWRAP_POSTGRES_CONF_ADDONS}" | ||
fi | ||
WITH_MIRRORS=${WITH_MIRRORS:="true"} | ||
if [[ "${WITH_MIRRORS}" == "true" ]]; then | ||
WITH_STANDBY="true" | ||
fi | ||
|
||
export -f USAGE | ||
|
||
export enable_gpfdist | ||
export with_openssl | ||
|
||
export DEMO_PORT_BASE="$PORT_BASE" | ||
export NUM_PRIMARY_MIRROR_PAIRS | ||
export WITH_MIRRORS | ||
export WITH_STANDBY | ||
export BLDWRAP_POSTGRES_CONF_ADDONS | ||
export DEFAULT_QD_MAX_CONNECT=150 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
WORKDIR=$(dirname "$0") | ||
GPDEMO_LIB=$WORKDIR/lib/gpdemo | ||
|
||
README() { | ||
cat "$GPDEMO_LIB"/README | ||
} | ||
|
||
PROBE_CONFIG() { | ||
source_gpdemo_defaults | ||
"$GPDEMO_LIB"/probe_config.sh | ||
} | ||
|
||
DEMO_CLUSTER() { | ||
source_gpdemo_defaults | ||
"$GPDEMO_LIB"/demo_cluster.sh "$@" | ||
} | ||
|
||
source_gpdemo_defaults() { | ||
. "$GPDEMO_LIB"/gpdemo-defaults.sh | ||
|
||
# overwrite the shorter usage defined in gpdemo-defaults.sh | ||
USAGE() { | ||
echo "" | ||
echo " gpdemo {-c | -d | -p | -h | -H | -v} <-K>" | ||
echo " : Default behaviour (no argument) is to create demo cluster." | ||
echo " -c : Check if demo is possible." | ||
echo " -d : Delete the demo." | ||
echo " -K : Create cluster without data checksums." | ||
echo " -p : Probe configuration of an alive cluster." | ||
echo " -h : Usage, prints this message." | ||
echo " -H : Detailed usage." | ||
echo " -v : Show version." | ||
echo "" | ||
echo " There are few environment variables (e.g., PORT_BASE, DATADIRS) to" | ||
echo " further config the demo cluster. See \"gpdemo -H\" for more info." | ||
echo "" | ||
} | ||
} | ||
|
||
CHECK_FILENAME=("demo_cluster.sh" "probe_config.sh" "gpdemo-defaults.sh" "lalshell" "README" "../gp_bash_version.sh") | ||
for filename in "${CHECK_FILENAME[@]}"; do | ||
checking="$GPDEMO_LIB"/"$filename" | ||
if [[ ! -f "$checking" ]]; then | ||
echo "Missing $checking" | ||
echo "" | ||
echo "This may be caused by incomplete installation or packaging error." | ||
echo "Try to re-install CloudBerryDB. If it doesn't help, contact support." | ||
exit 1 | ||
fi | ||
done | ||
|
||
. "$WORKDIR"/lib/gp_bash_version.sh | ||
|
||
while getopts ":pHv" opt | ||
do | ||
case $opt in | ||
p) PROBE_CONFIG; exit 0;; | ||
H) README; exit 0;; | ||
v) print_version; exit 0;; | ||
*) DEMO_CLUSTER "$@"; exit $?;; # fallback to demo_cluster.sh | ||
esac | ||
done | ||
|
||
# default behaviour is fallback to "demo_cluster.sh" (no argument) | ||
DEMO_CLUSTER |