Return-Path: postarch
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA09649; Mon, 2 Dec 91 13:03:10 -0800
Message-Id: <9112022103.AA09649@postgres.Berkeley.EDU>
From: postarch (Postgres Mailing Archive)
Subject: Re: Unable to connect to backend
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
In-Reply-To: Your message of "Sat, 23 Nov 91 16:46:50 PST."
             <9111240046.AA29898@postgres.Berkeley.EDU> 
Date: Mon, 02 Dec 91 13:02:54 PST

In message <9111240046.AA29898@postgres.Berkeley.EDU> you write:
> 
> I'm unable to connect to the postgres backend even after
> restarting the postmaster. I get the following message:
> 
> -----------------
> * retrieve (TODAY.all) \g
> 
> Query sent to backend is "retrieve (TODAY.all) "
> Error: Failed to connect to backend (host=localhost, port=4321)
> -----------------
> 
> When I run the postgres backend itself, I'm able to
> connect to it.
> 
> Any suggestions?

It looks as though the postmaster and monitor are using different
ports... Did you use the -p <port #> option to the postmaster when you
started it?  If so you should either use -p <port #> when running the
monitor or set PGPORT in your environment to the corresponding port #
you used for the postmaster.

Another possibility:  are the postmaster and monitor running on the same
machine?  If not use the -h <hostname> option to the monitor so that it 
knows what machine the postmaster is running on.

Where there any problems in starting the postmaster?  If you still can't
connect you should make sure it is still running:

	ps axu | grep postmaster

Running the postgres back standalone does not go through the postmaster
at all.  Only when you run a libpq application (e.g. the monitor) is an 
initial connection to the postmaster needed.  The postmaster will fork a 
copy of the POSTGRES backend and then set up the front-end/back-end socket 
communication.  (Running standalone also means that you have your own private 
copy of shared memory and semaphores and therefore POSTGRES cannot safeguard 
your database in the case of concurrent access by you and other potential
users.)
