forked from ApsaraDB/PolarDB-for-PostgreSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonekey.sh
executable file
·69 lines (61 loc) · 2.36 KB
/
onekey.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
echo "This script uses default configuration to compile PolarDB, to deploy binary, "
echo "and to start a cluster of three nodes including a leader, 2 follower. "
echo " all: one key for full environment build, include build source code、deploy"
"and setup 3 node paxos environment by default configure."
echo " build: configure the build with performance optimzation"
echo " with assertion enabled, and then build"
echo " configure: create default configure."
echo " deploy: deploy binary to all related machine."
echo " setup: setup 3 node paxos environment by default configure"
echo " cm: setup cluster manager component."
echo " clean: clean environment"
echo ""
set -e
pushd "$( dirname "${BASH_SOURCE[0]}" )"
CODEHOME=$PWD
if [ -z $PG_INSTALL ];
then
PG_INSTALL=$HOME/polardb/polardbhome
fi
echo "PG installation dir: "$PG_INSTALL
PGBIN=$PG_INSTALL/bin
if [ $# -gt 0 ]; then
BLD_OPT=$1
else
BLD_OPT="all"
fi
CMD=()
if [[ "$BLD_OPT" == "all" ]]; then
sh ./build.sh
mkdir -p $HOME/polardb
touch $HOME/polardb/polardb_paxos.conf
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf prepare standalone
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf deploy all
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf clean all
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf init all
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf deploy cm
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf monitor all
elif [[ "$BLD_OPT" == "build" ]]; then
sh ./build.sh
elif [[ "$BLD_OPT" == "configure" ]]; then
mkdir -p $HOME/polardb
touch $HOME/polardb/polardb_paxos.conf
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf prepare standalone
elif [[ "$BLD_OPT" == "deploy" ]]; then
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf deploy all
elif [[ "$BLD_OPT" == "setup" ]]; then
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf clean all
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf init all
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf monitor all
elif [[ "$BLD_OPT" == "cm" ]]; then
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf deploy cm
elif [[ "$BLD_OPT" == "clean" ]]; then
pgxc_ctl -c $HOME/polardb/polardb_paxos.conf clean all
else
echo "Invalid Parameter! Usage: $0 [all|build|configure|deploy|setup|cm|clean]"
popd
exit
fi
echo "============> Enjoy polardb! <==============="
popd