[458342f] | 1 | <sect2>
|
---|
| 2 | <title>Configuring <application>Postgre<acronym>SQL</acronym></application></title>
|
---|
| 3 |
|
---|
| 4 | <sect3>
|
---|
| 5 | <title>Config files</title>
|
---|
| 6 |
|
---|
| 7 | <para><filename>$PGDATA/pg_ident.con</filename>, <filename>$PGDATA/pg_hba.conf</filename>, <filename>$PGDATA/postgresql.conf</filename></para>
|
---|
| 8 |
|
---|
| 9 | <para>The <envar>PGDATA</envar> environment variable is used to distinguish database
|
---|
| 10 | clusters from one another by setting it to the value of the directory
|
---|
| 11 | which contains the cluster desired. The three configuration files
|
---|
| 12 | exist in every <filename class="directory">PGDATA/</filename> directory.
|
---|
| 13 | Details on the format of the files and the options that can be set in
|
---|
| 14 | each can be found in <ulink
|
---|
| 15 | url="file:///usr/share/doc/postgresql/html/index.html"/>.</para>
|
---|
| 16 |
|
---|
| 17 | <para>Create the boot script with the following: </para>
|
---|
| 18 |
|
---|
| 19 | <screen><userinput><command>cat > /etc/rc.d/init.d/postgresql << "EOF"</command>
|
---|
| 20 | #!/bin/bash
|
---|
| 21 | # Begin $rc_base/init.d/postgresql
|
---|
| 22 |
|
---|
| 23 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 24 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 25 |
|
---|
| 26 | source /etc/sysconfig/rc
|
---|
| 27 | source $rc_functions
|
---|
| 28 |
|
---|
| 29 | case "$1" in
|
---|
| 30 | start)
|
---|
| 31 | echo "Starting PostgreSQL daemon..."
|
---|
| 32 | su - postgres -c '/usr/bin/pg_ctl start -W -D /var/pgsql/data \
|
---|
| 33 | -l /var/pgsql/data/logfile -o "-i" '
|
---|
| 34 | evaluate_retval
|
---|
| 35 | ;;
|
---|
| 36 |
|
---|
| 37 | stop)
|
---|
| 38 | echo "Stopping PostgreSQL daemon..."
|
---|
| 39 | /usr/bin/pg_ctl stop -m smart -D /var/pgsql/data
|
---|
| 40 | evaluate_retval
|
---|
| 41 | ;;
|
---|
| 42 |
|
---|
| 43 | restart)
|
---|
| 44 | $0 stop
|
---|
| 45 | sleep 1
|
---|
| 46 | $0 start
|
---|
| 47 | ;;
|
---|
| 48 |
|
---|
| 49 | status)
|
---|
| 50 | /usr/bin/pg_ctl status -D /var/pgsql/data
|
---|
| 51 | ;;
|
---|
| 52 |
|
---|
| 53 | *)
|
---|
| 54 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
| 55 | exit 1
|
---|
| 56 | ;;
|
---|
| 57 | esac
|
---|
| 58 |
|
---|
| 59 | # End $rc_base/init.d/
|
---|
| 60 | <command>EOF
|
---|
| 61 | chmod 755 /etc/rc.d/init.d/postgresql</command></userinput></screen>
|
---|
| 62 |
|
---|
| 63 | <para>Create the symbolic links to this file in the relevant
|
---|
| 64 | <filename class="directory">rc.d</filename> directory
|
---|
| 65 | with the following commands:</para>
|
---|
| 66 |
|
---|
| 67 | <screen><userinput><command>cd /etc/rc.d/init.d &&
|
---|
| 68 | ln -sf ../init.d/postgresql ../rc0.d/K26postgresql &&
|
---|
| 69 | ln -sf ../init.d/postgresql ../rc1.d/K26postgresql &&
|
---|
| 70 | ln -sf ../init.d/postgresql ../rc2.d/K26postgresql &&
|
---|
| 71 | ln -sf ../init.d/postgresql ../rc3.d/S34postgresql &&
|
---|
| 72 | ln -sf ../init.d/postgresql ../rc4.d/S34postgresql &&
|
---|
| 73 | ln -sf ../init.d/postgresql ../rc5.d/S34postgresql &&
|
---|
| 74 | ln -sf ../init.d/postgresql ../rc6.d/K26postgresql</command></userinput></screen>
|
---|
| 75 |
|
---|
| 76 | </sect3>
|
---|
| 77 |
|
---|
| 78 | </sect2>
|
---|