Thread: Snapshot is not working

Snapshot is not working

From
"Tille, Andreas"
Date:
Hello,

I compiled the snapshot from 16. Oct on Sparc Linux.  Make and make
install worked perfectly and I was able to start the postmaster as
described in INSTALL.  But:

postgres:~$ ps ax | grep post
 8575 ttyp4    S      0:00 /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
 8576 ttyp4    S      0:00 postgres: stats buffer process
 8578 ttyp4    S      0:00 postgres: stats collector process
 8624 ttyp0    S      0:00 grep post
postgres:~$ createuser tillea
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
psql: connectDBStart() -- connect() failed: No such file or directory
        Is the postmaster running locally
        and accepting connections on Unix socket '/var/run/postgresql/.s.PGSQL.5432'?
createuser: creation of user "tillea" failed

The logfile says:

DEBUG:  database system was shut down at 2001-10-19 09:57:16 CEST
DEBUG:  checkpoint record is at 0/123118
DEBUG:  redo record is at 0/123118; undo record is at 0/0; shutdown TRUE
DEBUG:  next transaction id: 90; next oid: 16556
DEBUG:  database system is ready

Does anybody see a reason for this failure?

Kind regards

          Andreas.

Re: Snapshot is not working

From
Tom Lane
Date:
"Tille, Andreas" <TilleA@rki.de> writes:
> psql: connectDBStart() -- connect() failed: No such file or directory
>         Is the postmaster running locally
>         and accepting connections on Unix socket '/var/run/postgresql/.s.PGSQL.5432'?

That's not the usual location for a PG socket file.  How did you tell
psql to look there, and are you sure the postmaster thinks the same?
(If there's a socket file present in /tmp rather than
/var/run/postgresql, it's a strong tipoff that you've gotten this
wrong...)

            regards, tom lane

Re: Snapshot is not working

From
"Tille, Andreas"
Date:
On Fri, 19 Oct 2001, Tom Lane wrote:

> "Tille, Andreas" <TilleA@rki.de> writes:
> > psql: connectDBStart() -- connect() failed: No such file or directory
> >         Is the postmaster running locally
> >         and accepting connections on Unix socket '/var/run/postgresql/.s.PGSQL.5432'?
>
> That's not the usual location for a PG socket file.  How did you tell
> psql to look there, and are you sure the postmaster thinks the same?
> (If there's a socket file present in /tmp rather than
> /var/run/postgresql, it's a strong tipoff that you've gotten this
> wrong...)
This is in fact the case.  I wrote an /etc/init.postgresql script
which does at start:


    touch ${POSTGRES_LOG:=/var/log/postgres.log}
    chown postgres.postgres $POSTGRES_LOG
    su - postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data  >$POSTGRES_LOG 2>&1 &"

which is in my opinion what the INSTALL file suggests.  I don´t know
why the socket is created as /tmp/.s.PGSQL.5432 ?  Any idea what could
be wrong?

Kind regards

      Andreas.

Re: Snapshot is not working

From
Stephan Szabo
Date:
On Tue, 23 Oct 2001, Tille, Andreas wrote:

> On Fri, 19 Oct 2001, Tom Lane wrote:
>
> > "Tille, Andreas" <TilleA@rki.de> writes:
> > > psql: connectDBStart() -- connect() failed: No such file or directory
> > >         Is the postmaster running locally
> > >         and accepting connections on Unix socket '/var/run/postgresql/.s.PGSQL.5432'?
> >
> > That's not the usual location for a PG socket file.  How did you tell
> > psql to look there, and are you sure the postmaster thinks the same?
> > (If there's a socket file present in /tmp rather than
> > /var/run/postgresql, it's a strong tipoff that you've gotten this
> > wrong...)
> This is in fact the case.  I wrote an /etc/init.postgresql script
> which does at start:
>
>
>     touch ${POSTGRES_LOG:=/var/log/postgres.log}
>     chown postgres.postgres $POSTGRES_LOG
>     su - postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data  >$POSTGRES_LOG 2>&1 &"
>
> which is in my opinion what the INSTALL file suggests.  I don�t know
> why the socket is created as /tmp/.s.PGSQL.5432 ?  Any idea what could
> be wrong?

Is it possible that you've got two versions of the libraries/programs
running around, maybe one from the RPMs (I think that'd probably be where
the RPMs would put the socket file).


Re: Snapshot is not working

From
Tom Lane
Date:
"Tille, Andreas" <TilleA@rki.de> writes:
> I don�t know
> why the socket is created as /tmp/.s.PGSQL.5432 ?

That is the normal place for it.  If you want it somewhere else, you
have to tell the postmaster so.  Did you set UNIX_SOCKET_DIRECTORY
in postgresql.conf?

            regards, tom lane

Re: Snapshot is not working

From
"Tille, Andreas"
Date:
On Tue, 23 Oct 2001, Tom Lane wrote:

> That is the normal place for it.  If you want it somewhere else, you
> have to tell the postmaster so.  Did you set UNIX_SOCKET_DIRECTORY
> in postgresql.conf?
No I did not.  Even if I set

    unix_socket_directory = '/tmp'

explicitely in /usr/local/pgsql/data/postgresql.conf but this doesn´t
change anything.  Moreover I tracked down the problem and detected
that my /etc/init.d/postgres script had a remainder from my previous
Debian installation of Postgresql 7.1.3. (POSTGRESHOME was set to
/var/lib/postgres).  I removed this.

Now I included a "set -x" into /etc/init.d/postgresql :

+ PGSQLPATH=/usr/local/pgsql
+ DATAPATH=/usr/local/pgsql/data
+ POSTMASTER=/usr/local/pgsql/bin/postmaster
+ . /usr/local/pgsql/data/postmaster.conf
++ '[' -z '' ']'
++ POSTGRESHOME=/usr/local/pgsql/data
++ PGDATESTYLE=GERMAN
+ PGDATA=/usr/local/pgsql/data
+ export PGDATA PGSQLPATH DATAPATH POSTMASTER POSTGRESHOME PGDATESTYLE
+ echo /usr/local/pgsql/data /usr/local/pgsql /usr/local/pgsql/data /usr/local/pgsql/bin/postmaster
/usr/local/pgsql/dataGERMAN 
/usr/local/pgsql/data /usr/local/pgsql /usr/local/pgsql/data /usr/local/pgsql/bin/postmaster /usr/local/pgsql/data
GERMAN
+ startup
+ touch /var/log/postgres.log
+ chown postgres.postgres /var/log/postgres.log
+ su - postgres -c '/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data  >/var/log/postgres.log 2>&1 &'
+ exit 0

and I do not see any remander from the Debian settings but the problem
remains that the socket is created under /tmp but from postgres
expected to be under /var/run/postgresql/.s.PGSQL.5432.

Any idea?

Kind regards

         Andreas.

Re: Snapshot is not working

From
Tom Lane
Date:
"Tille, Andreas" <TilleA@rki.de> writes:
> No I did not.  Even if I set
>     unix_socket_directory = '/tmp'
> explicitely in /usr/local/pgsql/data/postgresql.conf but this doesn�t
> change anything.

No, because that's telling the postmaster to put the socket in /tmp,
which is what it was doing anyway.  Your problem is that psql is doing
something different from the postmaster.

> and I do not see any remander from the Debian settings but the problem
> remains that the socket is created under /tmp but from postgres
> expected to be under /var/run/postgresql/.s.PGSQL.5432.

Do you perhaps have PGHOST set to /var/run/postgresql in psql's
environment?

            regards, tom lane

Re: Snapshot is not working (Solution)

From
"Tille, Andreas"
Date:
Please call me stupid:  The reason for my trouble was just a wrong path
of user postgres which was using the old createuser binary.  All other
things where working perfectly.

Sorry for the confusion.

Kind regards

        Andreas.

Re: Snapshot is not working

From
"Tille, Andreas"
Date:
On Wed, 24 Oct 2001, Tom Lane wrote:

> "Tille, Andreas" <TilleA@rki.de> writes:
> > No I did not.  Even if I set
> >     unix_socket_directory = '/tmp'
> > explicitely in /usr/local/pgsql/data/postgresql.conf but this doesn´t
> > change anything.
>
> No, because that's telling the postmaster to put the socket in /tmp,
> which is what it was doing anyway.  Your problem is that psql is doing
> something different from the postmaster.
Well OK, than it works with

      unix_socket_directory = '/var/run/postgresql'

now.  Thanks for the hint.  On the other hand:  How can I really make sure
that my postgresql snapshot is running.  I´m afraid that there are some
remainders from my 7.1.3 installation which might has caused this trouble.

> > and I do not see any remander from the Debian settings but the problem
> > remains that the socket is created under /tmp but from postgres
> > expected to be under /var/run/postgresql/.s.PGSQL.5432.
>
> Do you perhaps have PGHOST set to /var/run/postgresql in psql's
> environment?
No, it´s empty.

Kind regards

       Andreas.