Commit 20074523 authored by iSergio's avatar iSergio
Browse files

Add primary/standby to postgresql prepare configure

parent ba82af65
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -15,6 +15,30 @@ if ! [[ $choice =~ ^([yY][eE][sS]]|[yY])$ ]]; then
    exit 0
fi

TYPE=primary

usage="$(basename "$0") [-h] [-p|s] [-a|b] [-d] -- Script configure pgpool-II
    where:
        -h  show this help text and exit
        -p  configure PostgreSQL as primary
        -s  configure PostgreSQL as standby
"
while getopts ':psvhabd' option; do
    case "$option" in
        p) TYPE=primary
            ;;
        s) TYPE=standby
            ;;
        h) echo "$usage"
            exit
            ;;
        \?) printf "illegal option: -%s\n" "$OPTARG" >&2
            echo "$usage" >&2
            exit 1
            ;;
    esac
done

/etc/init.d/pgpool stop

sed -i "s/PGPORT=5432/PGPORT=5433/g" /etc/sysconfig/pgsql/postgresql
@@ -62,4 +86,6 @@ sed -i 's/__PGPOOL_STANDBY_HOST__/'$PGPOOL_STANDBY_HOST'/g' /usr/local/bin/pg_re

cp -rf tsearch_data/* /usr/share/pgsql/tsearch_data/

if [[ "$TYPE" == "primary" ]]; then
    pg_replication -c
fi