Commit 70c5e0d0 authored by iSergio's avatar iSergio
Browse files

PgPool configure improve

parent 7a7e257d
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ if ! [[ $choice =~ ^([yY][eE][sS]]|[yY])$ ]]; then
fi

TYPE=primary
VERBOSE=false

usage="$(basename "$0") [-h] [-p] [-s] -- Script configure pgpool-II
 where:
@@ -23,7 +24,7 @@ usage="$(basename "$0") [-h] [-p] [-s] -- Script configure pgpool-II
     -p  configure pgpool as primary
     -s  configure pgpool as standby"

while getopts ':psdvh' option; do
while getopts ':psvh' option; do
    case "$option" in
        p) TYPE=primary
            ;;
@@ -31,8 +32,6 @@ while getopts ':psdvh' option; do
            ;;
        v) VERBOSE=true
            ;;
        d) DEPLOY=true
            ;;
        h) echo "$usage"
            exit
            ;;
@@ -47,6 +46,14 @@ read -r -p "For which server will be configured PgPool-II(primary | standby) (De
if [[ ! -z $_TYPE ]]; then
    TYPE=$_TYPE
fi
read -r -p "PgPool primary host (Default: $PGPOOL_PRIMARY_HOST):" _PGPOOL_PRIMARY_HOST
if [[ ! -z $_PGPOOL_PRIMARY_HOST ]]; then
    PGPOOL_PRIMARY_HOST=$_PGPOOL_PRIMARY_HOST
fi
read -r -p "PgPool standby host (Default: $PGPOOL_STANDBY_HOST):" _PGPOOL_STANDBY_HOST
if [[ ! -z $_PGPOOL_STANDBY_HOST ]]; then
    PGPOOL_STANDBY_HOST=$_PGPOOL_STANDBY_HOST
fi
read -r -p "PgPool trusted servers (Default: $PGPOOL_TRUSTED_SERVERS):" _PGPOOL_TRUSTED_SERVERS
if [[ ! -z $_PGPOOL_TRUSTED_SERVERS ]]; then
    PGPOOL_TRUSTED_SERVERS=$_PGPOOL_TRUSTED_SERVERS
@@ -60,7 +67,6 @@ if [[ ! -z $_PGPOOL_INTERFACE ]]; then
    PGPOOL_INTERFACE=$_PGPOOL_INTERFACE
fi


# pgpool dir
PGPOOL_DIR=/etc/pgpool-II
PGPOOL_CONFIG=$PGPOOL_DIR/pgpool.conf
@@ -69,8 +75,8 @@ cp -rf pgpool-II/pgpool-$TYPE.conf $PGPOOL_CONFIG
cp -rf init.d/pgpool /etc/init.d/pgpool
cp -rf sysconfig/pgpool /etc/sysconfig/pgpool

sed -i 's/__PRIMARY_HOST__/'$PRIMARY_HOST'/g' $PGPOOL_CONFIG
sed -i 's/__STANDBY_HOST__/'$STANDBY_HOST'/g' $PGPOOL_CONFIG
sed -i 's/__PGPOOL_PRIMARY_HOST__/'$PGPOOL_PRIMARY_HOST'/g' $PGPOOL_CONFIG
sed -i 's/__PGPOOL_STANDBY_HOST__/'$PGPOOL_STANDBY_HOST'/g' $PGPOOL_CONFIG
sed -i 's/__PGPOOL_TRUSTED_SERVERS__/'$PGPOOL_TRUSTED_SERVERS'/g' $PGPOOL_CONFIG
sed -i 's/__PGPOOL_DELEGATE_IP__/'$PGPOOL_DELEGATE_IP'/g' $PGPOOL_CONFIG
sed -i 's/__PGPOOL_INTERFACE__/'$PGPOOL_INTERFACE'/g' $PGPOOL_CONFIG
+3 −3
Original line number Diff line number Diff line
@@ -47,13 +47,13 @@ pcp_socket_dir = '/tmp'

# - Backend Connection Settings -

backend_hostname0 = '__PRIMARY_HOST__'
backend_hostname0 = '__PGPOOL_PRIMARY_HOST__'
backend_port0 = 5433
backend_weight0 = 1
backend_data_directory0 = '/var/lib/pgsql/data'
backend_flag0 = 'ALLOW_TO_FAILOVER'

backend_hostname1 = '__STANDBY_HOST__'
backend_hostname1 = '__PGPOOL_STANDBY_HOST__'
backend_port1 = 5433
backend_weight1 = 1
backend_data_directory1 = '/var/lib/pgsql/data'
@@ -458,7 +458,7 @@ ping_path = '/bin'

# - Watchdog communication Settings -

wd_hostname = '__PRIMARY_HOST__'
wd_hostname = '__PGPOOL_PRIMARY_HOST__'
                                    # Host name or IP address of this watchdog
                                    # (change requires restart)
wd_port = 9000