Forum OpenACS Q&A: restart-aolserver doesn't work

Collapse
Posted by Cristian Salan on
I am realy a newbie about this and of course I have many troubles.

My system is a SuSE 7.1 (kernel 2.2.18 I think), AOL 3.4, PostgreSQL
7.1.3 (pgdriver-2.0.1) and Open ACS 3.2.5.

From the contributed files in PostgreSQL I used the starting file
moving it to /etc/init.d/postgresql and symlinks to /etc/rc.d/rc0.d to
rc5.d as explained into the original file. Works fine, but how can I
include the tips from Don Baccus (OpenACS Installation Guide)
regarding the allocated memory (-B 1000 -o "S 2000") and still use the
starting file I have?

To check the data model the command
psql -f load-data-model.sql yourdb 262; datamodel.txt
returned me an error, user 262 does not exist. What to do to check for
errors the db?

The Restart the ... community web process link in admin pages returned
a message: "There is no restart parameter in the auxiliary .ini file.
Please make sure it is there.". Somehow confusing, I am using the .tcl
file to start the server. How can I make this working?

I have done what's in guide about restart-aolserver but it seems not
to work. It doesn't kill any process. The only message is: Killing.
And now that's killing me. Somewhere on ardigita.com I saw a problem
related to suid on SuSE, but I can't get it working as root and I
think I have to solve this first.
In addition, Arjun Sanyal submitted another version of
restart-aolserver but I can't find it in SDM.

Help needed, please,
Cristian Salan

Collapse
Posted by David Kuczek on
Hello Christian,

the following thread might help you with the killing problem...

https://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0001yy

Collapse
Posted by Richard Hamilton on
If you download the administrator manual from the PostgreSQL site and study it you will find information on starting Postgres without worrying about incorporating the script in the run level system. This worked on my systems which are Mandrake 8.0 and 8.1. The command line parameters can be replaced by using the postgres.conf file which is documented in the administrator manual and is found in the /data directory of the postgres installation.

What I have had a problem with is installing the Postgres AOL server driver. I first tried the newest version downloaded from the OpenACS site but despite setting up the symlink to the shared postgres libraries, the AOL Server log reports that it cannot open the driver. The docs say that a previous version of the driver is shipped with the AOL Server distribution - but I can't find it. Has anyone had this issue? Any suggestions anyone?

Collapse
Posted by Jun Yamog on
Hi Cristian,

You may modify your init.d/postgres scripts try this one out.  It may not be exactly what you have since mine is modified.  Use postmaster -o and put in single quotes the options you want it to run.  In my case I use "-B 2000 -o -S2000 -i"

Here is what I have:

su -l postgres -s /bin/sh -c "LC_ALL=C ${PGHOME}/bin/pg_ctl  -D $PGDATA -p ${PGHOME}/bin/postmaster -o '-B 2000 -o -S2000 -i' start  > /dev/null 2>&1" < /dev/null

Look around the for postmaster it should be around the start case of the shell script.  If you need further help just email me.  You may even email me your init.d/postgres

I use daemon tools to start stop and restart my services like aolserver.  Take a look at it on http://cr.yp.to/daemontools.html.  Its not very friendly but once you get the hang of it you will want all your unix services being supervised by it.  Plus in a multi developer environment I can assign who can start and restart which aolserver.  Normally I run about a dozen aolserver on a single machine so daemontools helps a lot.

Collapse
5: postmaster flags (response to 1)
Posted by S. Y. on
If I understand correctly, you don't need to use the command-line option flags with postmaster anymore. You can change the settings to whatever you desire in your /usr/local/pgsql/data/postgresql.conf file. The -B flag is shared_buffers; the -o "S 2000" flag is sort_mem. Both are listed in the Performance section of the aforementioned PostgreSQL configuration file. I believe by default, the entire file is commented out.

Sorry, I don't know anything about the restart-aolserver stuff.

Collapse
Posted by Jun Yamog on
Hi Sean,

I think your method is better.  So its possible to tune postgres on a per db level right?  Has anyone run PG with 2 or more db running?  Not the db that is created using createdb but the db that is created in initdb.

Much like Oracle can run 2 or more database each db instance is different from another.

*Off-topic* what happend to c-cup.com?  Its a good site to get ACS newbies.  I think it is the best site, you get good technical stuff aside from the side show.

Collapse
Posted by S. Y. on
I've only run one PostgreSQL instance and never in production (just puttering around), so someone else can explain the implications of running two separate pgsql databases at the same time and what sort of  autonomy they might enjoy.

As to your off-topic query, sadly the site in question is down for the foreseeable future. It was being hosted from a $39.95/mo. Telocity 784K/784K symmetric line on NorthPoint DSL network which was unceremoniously shut down at the end of March. No other broadband provider offers the same combination of service offerings and pricing; they all went out of business. (Although I detest booting Windoze, my $4.95 per month for 150 hours of dial-up modem access is adequate for my current personal needs.)

In any case, I haven't done any web/db work for over a year and a half, so those old articles are really more for a hindrance/distraction to solving issues for today's developers. I'm glad you enjoyed the site, although your reasons are perhaps different than those of the majority of visitors. Or maybe not. :)

Collapse
Posted by S. Y. on

Cristian, if for some reason you really, really want to do this in the startup script, you can. I've hacked the rc.d init script that ships with the PostgreSQL 7.1.3 source (file: contrib/start-scripts/linux) by adding a PGOPTIONS variable that gets passed to postmaster.

    #! /bin/sh
    
    # This is an example of a start/stop script for SysV-style init, such
    # as is used on Linux systems.  You should edit some of the variables
    # and maybe the 'echo' commands.
    #
    # Place this file at /etc/init.d/postgresql (or
    # /etc/rc.d/init.d/postgresql) and make symlinks to
    #   /etc/rc.d/rc0.d/K02postgresql
    #   /etc/rc.d/rc1.d/K02postgresql
    #   /etc/rc.d/rc2.d/K02postgresql
    #   /etc/rc.d/rc3.d/S98postgresql
    #   /etc/rc.d/rc4.d/S98postgresql
    #   /etc/rc.d/rc5.d/S98postgresql
    # Or check out the chkconfig program, if you have it.
    #
    # Proper init scripts on Linux systems normally require setting lock
    # and pid files under /var/run as well as reacting to network
    # settings, so you should treat this with care.
    
    # Original author:  Ryan Kirkpatrick 
    
    # $Header: /home/projects/pgsql/cvsroot/pgsql/contrib/start-scripts/linux,v 1.2 2001/04/19 19:17:44 petere Exp $
    
    ## EDIT FROM HERE
    
    # Installation prefix
    prefix=/usr/local/pgsql
    
    # Data directory
    PGDATA="/usr/local/pgsql/data"
    
    # Who to run pg_ctl as, should be "postgres".
    PGUSER=postgres
    
    # Where to keep a log file
    PGLOG="$PGDATA/serverlog"
    
    # options for postmaster (a.k.a. postgres)
    # we're setting shared_buffers to 1000 and sort_mem to 2000
    # N.B. this can be done in /usr/local/pgsql/data/postgresql.conf now
    PGOPTIONS='-B 1000 -o "-S 2000"'
    
    ## STOP EDITING HERE
    
    # Check for echo -n vs echo c
    if echo 'c' | grep -s c >/dev/null 2>&1 ; then
        ECHO_N="echo -n"
        ECHO_C=""
    else
        ECHO_N="echo"
        ECHO_C='c'
    fi
    
    # The path that is to be used for the script
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # What to use to start up the postmaster
    DAEMON="$prefix/bin/pg_ctl"
    
    set -e
    
    # Only start if we can find pg_ctl.
    test -f $DAEMON || exit 0
    
    # Parse command line parameters.
    case $1 in
      start)
    	$ECHO_N "Starting PostgreSQL: "$ECHO_C
    	# original
    	# su - $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG" 
    	# passing options to postmaster
    	su - $PGUSER -c "$DAEMON start -D '$PGDATA' -s -l $PGLOG -o '$PGOPTIONS'" 
    	echo "ok"
    	;;
      stop)
    	echo -n "Stopping PostgreSQL: "
    	su - $PGUSER -c "$DAEMON stop -D '$PGDATA' -s -m fast"
    	echo "ok"
    	;;
      restart)
    	echo -n "Restarting PostgreSQL: "
    	su - $PGUSER -c "$DAEMON restart -D '$PGDATA' -s -m fast"
    	echo "ok"
    	;;
      status)
    	su - $PGUSER -c "$DAEMON status -D '$PGDATA'"
    	;;
      *)
    	# Print help
    	echo "Usage: $0 {start|stop|restart|status}" 1>&2
    	exit 1
    	;;
    esac
    
    exit 0
    

Use at your own risk, no warranties, blah, blah. Enjoy.

Collapse
Posted by Don Baccus on
For starters, it is perhaps better to use the configuration file rather than command line parameters when starting the postmaster.  My documentation on starting up the postmaster and increasing shared buffer  space, etc was written before the configuration file existed, and should probably be updated, maybe even by me though I'd love it if someone else  decided to write a new document.

I don't see any advantage in running multiple postmasters on multiple initdb'd dbs.  I've done it when I've wanted to run a beta or cvs-current instance on a server along with a current release, for instance to test whether or not OpenACS still works after PG changes.

Other than that, though, I think you're best off with one postmaster.

Collapse
10: Thank you everybody! (response to 1)
Posted by Cristian Salan on
I'm for the first time on a discussion forum and the community feeling is great indeed.

And now, step by step.

David,
Perhaps I'm the newbie of the newbies but that thread did not help. In command line I have no problem with ps aux and there is nothing with aux in the restart-aolserver script.

Richard,
Of course, you are perfectly right, but I am crowded with lots of docs printed and I don't know which to use firs. Documentation of OpenACS, AOL Server, PostgreSQL, SuSE, ACS, Tcl, SQL, etc. I know it was better to have some background. I don't, but at least I want to do this.

Jun & Sean,
Again, you show me the benefits of a community beyond Philip Greenspun's books.

I have tried both variants from Sean. The modified script listed above by Sean did start OK the postmaster although something went wrong because I was unable to connect to db.
Modifying the /usr/local/data/postgresql.conf file seemed to me the easy way. Done and it's working, but how can I verify that the postmaster is using the .conf file and now I have those flags set.

Don Baccus,
I don't figure why is still hard to start and configure properly an Open ACS system, as long as this has been done so many times by others. Yes, the documentation is great but it could be better. I think that could be more Open ACS systems working, faster to set up and configure and more reliable and have more active users at openacs.org with a better documentation.
Did you think how many newbies give it up because seemed too complicated for them and couldn't even see how great is working?

Perhaps OpenACS4 comes with lots of enhancements regarding this subject.

Thank you again for beeing there!

Collapse
Posted by Jun Yamog on
Hi Don,

I may need it a patch up solution.  Some of our older sites has some problems running PG 7.1.3 so I am planning to run 7.0.3 and 7.1.3 on the same box while this older sites are being fixed.  Has anybody done this?

Jun