Обсуждение: Success !!

Поиск
Список
Период
Сортировка

Success !!

От
johnbr@vossnet.co.uk (John Bright)
Дата:
Oliver,
You are indeed a star !!
I did a re-install of Linux, did the tweak to LDFLAGS and just
as you said, a clean compile of Postgresql first time !
Having acheived that, unfortunately, I'm now going to bombard
you with a stack of follow up question, hopefully most of them
are pretty quick and just to confirm my installation is pukka.
The regression tests hit just one failure, which was for
numerology. Should I be worried about this ?
I would like to do as the INSTALL says, to get the postmaster
to load at boot time. I tried one of the options listed in the
INSTALL document (the Red Hat amendment to /etc/inittab)
and succeeded in hanging my Linux machine on reboot, but
fortunately manage to recover with the rescue system ( l learned
about the rescue system very quickly !!).
Consequently, I'd just be interested to know if you have something
to acheive this. In the /contrib/linux area there is a script
called postgres.init, which looks promising, however, the comments
say this again is a RedHat script (so after my previous experience
am slightly nervous to set this one up). Also in that script it will
bomb out if networking is not running. I'm currently building my
server standalone. Also, it uses something called local 5 (don't
know what thats about). So, if you have something that you use
on your Linux machine to autoload/autoclose the postmaster
at boot time, that would be just groovy.
I'm setting up this Linux machine as a web server. I currently
have an e-commerce web site, which uses Perl CGI scripts
talking to an Access database. I want to convert this to run
against Postgres. There is a Perl interface for Postgres, but do
I have to do a recompile using the --with-perl option to
./configure to be able to run Perl/CGI scripts against the
database  ?? If I need to add in this Perl module it says this
has to be done on an existing Postgres system. If I do
./configure --with-perl
make clean
make all >& make.log & --- and then follow the rest of the
Postgres build procedure will I then have my Perl enabled db, or
is there a separate procedure for amending an installed instance ?
Whilst I'm at it, I may include the -m486 flag as a COPT, would
this be a good idea ?
Sorry, I've gone on long enough now, but just finally to close,
I'm building this web server using SuSE Linux 5.1, Perl,
Apache 1.2.4, Postgresql 6.3.1. Is there anything I should beware
of, any good tips you have for setting up a web server on that
platform. Are there benefits to be had by moving to 6.3.2 or 6.4 ?
Many Thanks for all your help, Oliver.
Best Regards
John

Re: Success !!

От
Oliver Mueschke
Дата:
jon,

i'm sorry, but i can't tell you anything about perl. i only did some
tests with the postgresql jdbc interface.

> The regression tests hit just one failure, which was for
> numerology. Should I be worried about this ?
in most cases no, but simply run src/test/regress/checkresults.
this gives you a diff of expected vs. your regression test results for
the failed tests. src/test/regress/README explains some reasons for
differing results.

> In the /contrib/linux area there is a script
> called postgres.init, which looks promising, however, the comments
> say this again is a RedHat script (so after my previous experience
> am slightly nervous to set this one up). Also in that script it will
> bomb out if networking is not running. I'm currently building my
> server standalone. Also, it uses something called local 5 (don't
> know what thats about).
for local[0-7] see man 3 syslog
the syslog local5 stuff works w/o problems. but i'm not shure about the
network thing. i think you should have a loopback device configured at
least. (you will need it for apache, too. right?)

> So, if you have something that you use
> on your Linux machine to autoload/autoclose the postmaster
> at boot time, that would be just groovy.
i use a modified script from an older postgres contrib dir (or the
faq?). here it is:
--- /sbin/init.d/postgresql.init -----------------------------
#!
/bin/sh
#
# postgres.init Start postgres back end
system.
#
# Author:       Thomas Lockhart
<Thomas.Lockhart@jpl.nasa.gov>
#               based on news startup by David
Myers
#
# Modified by Daniele
Arduini:
#       - support for bash
shell
#       - /usr/local/pgsql
installation
#
#
Assumptions:
# - the postgres user is named
"postgres"
# - the postgres user is running
bash
# - /etc/syslog.conf contains the line "local5.*
-/var/log/postgres"

[ -f /usr/local/pgsql/bin/postmaster ] || exit
0

# See how we were
called.
case "$1"
in

start)
    echo -n "Starting postgresql service:
"
    # force full login to get path names and environment
variables
    # postgres runs bash so use proper syntax in
redirection
    # change this line if the postgres superuser account is not
"postgres"
    # change this line if another shell syntax is
necessary
    su postgres -c 'nohup /usr/local/pgsql/bin/postmaster -i -B 256
\
       -D/usr/local/pgsql/data 2>&1 | logger -p local5.notice
&'
    sleep
2
    pid=`pidof
postmaster`
    echo -n "postmaster
[$pid]"
    touch
/var/lock/subsys/postmaster

echo

;;

stop)
    echo -n "Stopping postgresql service:
"
    killproc
/usr/local/pgsql/bin/postmaster
    sleep
2
    rm -f
/var/lock/subsys/postmaster

echo

;;

*)
    echo "Usage: postgres.init
{start|stop}"
    exit
1
esac

exit
0
-----------------------------------------------------------------------

to run this script with the appropriate parameter, you have to create
two links under rcX.d. example:
  cd /sbin/init.d/rc2.d
  ln -s../postgresql.init K05postgresql.init
  ln -s ../postgresql.init S86postgresql.init

this starts postgresql in runlevel 2. see /sbin/init.d/README,
man 1 init and the suse manual. you can use the script /sbin/rctab to
create and manage these links for the different runlevels.


> [snip]
> I'm building this web server using SuSE Linux 5.1, Perl,
> Apache 1.2.4, Postgresql 6.3.1. Is there anything I should beware
> of, any good tips you have for setting up a web server on that
> platform. Are there benefits to be had by moving to 6.3.2 or 6.4 ?

sorry, can't help you with this. from watching the postgresql lists, i
would say that you always should use the latest release (and apply
patches). this makes even more sense, as you don't have to deal with a
production environment so far.

regards
oliver

Re: Success !!

От
johnbr@vossnet.co.uk (John Bright)
Дата:
Oliver,
I tried your script.
I get the weirdest thing happening.
I added it as a file called postgres to the directory /sbin/init.d.
I created the two symbolic links in the subdirectory
as ln -s ../postgres S86postgres and K05postgres.
When I to run the script by typing
/sbin/init.d/postgres start, the script bombs out saying
No such file or directory.
I know the script will work because if I type
su - postgres -c "...etc .....etc " it brings up the postmaster
for me, and killproc similarly typed at the command line
shuts down the postmaster.
Have you got any ideas ?
Weird city or what ?
Regards
John

Re: Success !!

От
Oliver Mueschke
Дата:
John Bright wrote:
>
> Oliver,
> I tried your script.
> I get the weirdest thing happening.
> I added it as a file called postgres to the directory /sbin/init.d.
> I created the two symbolic links in the subdirectory
> as ln -s ../postgres S86postgres and K05postgres.
> When I to run the script by typing
> /sbin/init.d/postgres start, the script bombs out saying
> No such file or directory.
> I know the script will work because if I type
> su - postgres -c "...etc .....etc " it brings up the postmaster
> for me, and killproc similarly typed at the command line
> shuts down the postmaster.
> Have you got any ideas ?
> Weird city or what ?
> Regards
> John

oh,
probably a matter of my mail prog wrapping "long" lines before sending.
i turned this feature explicitly off and pasted the script again:
----------------------------------------------------------------------
#! /bin/sh
#
# postgres.init Start postgres back end system.
#
# Author:       Thomas Lockhart <Thomas.Lockhart@jpl.nasa.gov>
#               based on news startup by David Myers
#
# Modified by Daniele Arduini:
#       - support for bash shell
#       - /usr/local/pgsql installation
#
# Assumptions:
# - the postgres user is named "postgres"
# - the postgres user is running bash
# - /etc/syslog.conf contains the line "local5.*  -/var/log/postgres"

[ -f /usr/local/pgsql/bin/postmaster ] || exit 0

# See how we were called.
case "$1" in
  start)
    echo -n "Starting postgresql service: "
    # force full login to get path names and environment variables
    # postgres runs bash so use proper syntax in redirection
    # change this line if the postgres superuser account is not "postgres"
    # change this line if another shell syntax is necessary
    su postgres -c 'nohup /usr/local/pgsql/bin/postmaster -i -B 256 \
       -D/usr/local/pgsql/data 2>&1 | logger -p local5.notice &'
    sleep 2
    pid=`pidof postmaster`
    echo -n "postmaster [$pid]"
    touch /var/lock/subsys/postmaster
    echo
    ;;
  stop)
    echo -n "Stopping postgresql service: "
    killproc /usr/local/pgsql/bin/postmaster
    sleep 2
    rm -f /var/lock/subsys/postmaster
    echo
    ;;
  *)
    echo "Usage: postgres.init {start|stop}"
    exit 1
esac

exit 0
---------------------------------------------------------------------------

any better this time?
just curious: did you get answers for your perl questions?

oliver

Re: Success !!

От
johnbr@vossnet.co.uk (John Bright)
Дата:
Hi Oliver,
Yes, the script you gave me now works fine.
Yes one of your colleagues gave me some pointers on the Perl
stuff. I will have a go at that in the next few days.
Many Thanks for all your help
Regards
John