11.24
0
Options Used For Running PostregSQL
PostregSQL can be installed on the same machine or different from the apache web server. PostregSQL and Apache in one machine allows PostregSQL run only to accept connections over the network by running pg_ctl-o 'i' or postmaster-i. Rc.pgsql script, in order to accept connections from the network, should be
amended as follows:

#! /bin/sh
#   PostregSQL boot time startup script for Linux-Slackware.
#   Copy this file to /etc/rc.d/
#   Writen by Ismail Maha Putra <kendariit.blogspot.com>
#   Make change for you're proper instalation prefix
#   add this three line in /etc/rc.d/rc.M
#   if [ -x /etc/rc.d/rc/pgsql ]; then
#   . /etc/rc.d/rc.pgsql start
#   fi

PGSQLDIR=/usr/local/pgsql # installation prefix
PGSQLDATA="$PGSQLDIR/data"
PGSQLUSER=postgres
PGSQLLOG="$PGSQLDATA/server.log"
PGSQLD="$PGSQLDIR/bin/pg_ctl"

test -x "$PGSQLD" || exit 0
case $1 in
start)
    echo "Running PostgreSQL ..................."
    su - $PGSQLUSER -c "$PGSQLD start -D '$PGSQLDATA' -s -l @PGSQLLOG 'O -i'"
    echo -n 'postgresql'
        ;;
stop)
    echo "Stopping PostgreSQL .................."
    su - $PGSQLUSER -c "$PGSQLD stop -D '$PGSQLDATA' -s -m fast"
    echo "Done"
        ;;
restart)
    echo "Re-starting PostgreSQL .................."
    su - $PGSQLUSER -c "$PGSQLD restart -D '$PGSQLDATA' -s -m fast"
        ;;
status)
    su - $PGSQLUSER -c "$PGSQLD status -D '$PGSQLDATA'"
        ;;
*)
    echo "Usage: 'basename $0'" {start|stop|restart|status}" 1>&2
    exit 1
        ;;
esac
exit 0

PostgreSQL uses tcp protocol using port 5432. Hosts are allowed access restrictions can be configured via the PostgreSQL pg_hba.conf file.
PostgreSQL running a machine with Apache or with strict restrictions on the right to access the PostgreSQL host can improve security.

0 komentar:

Posting Komentar