Thread: error while starting database

error while starting database

From
"Nitin Saxena"
Date:
I am using postgres 7.0 on linux platform.
My java application was running fine ,but i got this message

Connection refused. Check that the hostname and port is correct, and that
the postmaster is r
unning with the -i flag, which enables TCP/IP networking.
at org.postgresql.Connection.openConnection(Connection.java:123)
at org.postgresql.Driver.connect(Driver.java:116)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
at SendGrpSmpp.run(SendGrpSmpp.java:96)


When i am connecting as su via su - postgres
at bash: when i give psql Database Name

It is giving error:

psql: connectDBStart() -- connect() failed: No such file or directory
        Is the postmaster running at 'localhost'
        and accepting connections on Unix socket '5432'?

when i am  using pg_ctl status command:

it   gives output:  pg_ctl: postmaster is running (pid: 776)
options are:
/usr/bin/postmaster
-p 5432
-D /var/lib/pgsql/data
-B 64
-b /usr/bin/postgres
-i
-N 32


when i am using pg_ctl stop  it gives

/usr/bin/pg_ctl: kill: (776) - No such pid
postmaster successfully shut down.


when i am using pg_ctl restart it gives


bash-2.04$ pg_ctl restart
/usr/bin/pg_ctl: kill: (776) - No such pid
Waiting for postmaster shutting
down...............................................................pg_ctl:
postmaster does not shut down


when i am giving pg_ctl start:

pg_ctl: It seems another postmaster is running. Try to start postmaster
anyway.
FATAL: StreamServerPort: bind() failed: No such file or directory
        Is another postmaster already running on that port?
        If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
pg_ctl: Cannot start postmaster. Is another postmaster is running?
bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.


Expecting your kind help on urgent.


Regards--
NItin Saxena

Re: error while starting database

From
Douglas Toltzman
Date:
PostgreSQL version 7.0 is really, really out of date, but as far as I
know, it should still work.

I generally use "ps -ax | grep postges" to see if there is a postgres
process running.  Also, I use "netstat -a" to see open sockets and
listening servers.

Have you removed the socket file in /tmp and tried to start the
server?  You may also want to check the server log to see if there is
any indication of why it crashed.  Once you clean up the residue from
the server that abended, you'll be able to start it again, unless
there are serious problems with the database.  I've only seen one
case where I couldn't get the server restarted, though, and that was
after a hard drive failure caused corruption in several files.  Even
then, I was able to recover everything.

BTW: the socket file ("/tmp/.s.PGSQL.5432") will be a hidden file.
You'll need to "ls -a /tmp" to see it.  You can just "rm -f /
tmp/.s.PGSQL.5432" as root and that should clean it up for you.

p.s. This is not a bug, and even if it was, I'm sure version 7.0 is
no longer supported.  You may want to use a different list if you
require additional assistance.

On Aug 17, 2007, at 10:31 AM, Nitin Saxena wrote:

>
>
> I am using postgres 7.0 on linux platform.
> My java application was running fine ,but i got this message
>
> Connection refused. Check that the hostname and port is correct,
> and that the postmaster is r
> unning with the -i flag, which enables TCP/IP networking.
> at org.postgresql.Connection.openConnection(Connection.java:123)
> at org.postgresql.Driver.connect(Driver.java:116)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
> at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
> at SendGrpSmpp.run(SendGrpSmpp.java:96)
>
>
> When i am connecting as su via su - postgres
> at bash: when i give psql Database Name
>
> It is giving error:
>
> psql: connectDBStart() -- connect() failed: No such file or directory
>         Is the postmaster running at 'localhost'
>         and accepting connections on Unix socket '5432'?
>
> when i am  using pg_ctl status command:
>
> it   gives output:  pg_ctl: postmaster is running (pid: 776)
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
>
> when i am using pg_ctl stop  it gives
>
> /usr/bin/pg_ctl: kill: (776) - No such pid
> postmaster successfully shut down.
>
>
> when i am using pg_ctl restart it gives
>
>
> bash-2.04$ pg_ctl restart
> /usr/bin/pg_ctl: kill: (776) - No such pid
> Waiting for postmaster shutting
> down...............................................................pg_
> ctl: postmaster does not shut down
>
>
> when i am giving pg_ctl start:
>
> pg_ctl: It seems another postmaster is running. Try to start
> postmaster anyway.
> FATAL: StreamServerPort: bind() failed: No such file or directory
>         Is another postmaster already running on that port?
>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.
>
>
> Expecting your kind help on urgent.
>
>
> Regards--
> NItin Saxena

Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938

Re: error while starting database

From
Tom Lane
Date:
"Nitin Saxena" <nitinmca05@gmail.com> writes:
> I am using postgres 7.0 on linux platform.

Egad.  At first I thought that was a typo, but if psql really spelled
its error message just like that, it must indeed be 7.0 or older :-(.
Do yourself a favor and get onto a newer version, NOW.  Not tomorrow.
There are hundreds if not thousands of known bugs in 7.0 that are fixed
in more modern versions.  Some of them *will* destroy your data.

As for getting out of the immediate problem, it looks like there is
something wrong with the directory that PG wants to put its socket file
into.  Perhaps /tmp is not there or not world writable?

            regards, tom lane

Re: error while starting database

From
Douglas Toltzman
Date:
If it is true that listing /tmp (ls -a /tmp) returns no such file or
directory, then that may be the problem.  You should have a world-
writable /tmp folder, as Tom already pointed out.  Also, an update to
a more stable version of PostgreSQL is still highly recommended.

On Aug 17, 2007, at 11:12 PM, Nitin Saxena wrote:

> Hi
>
>   All the command  such as    gives following output;
>
>   1: :ls -a/tmp: No such file or directory
>
>    2  : "rm -f/tmp/.s.PGSQL.5432"
>      bash: rm -f/tmp/.s.PGSQL.5432: No such file or directory
>
>   3:"ps -ax|grep postgres"
>     bash: ps -ax|grep postgres: command not found
>
>
> Does PID in postmaster.pid  file is automatically created when we
> start the database.
>
> When i am giving command pg_ctl status at root, It is giving error
> message as
>
> pg_ctl: No database directory or environment variable $PGDATA is
> specified
>
>
>                and
>
> When i am giving command pg_ctl status at bash it is giving
> postmaster is running
>
> [root@imap /root]# su - postgres
> bash-2.04$ pg_ctl status
> pg_ctl: postmaster is running (pid: 776)
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
> When i am giving command  at root directory:
>
> [root@imap /root]# pg_ctl stop
> pg_ctl: No database directory or environment variable $PGDATA is
> specified
>
> [root@imap /root]# su - postgres
> bash-2.04$ pg_ctl stop
> /usr/bin/pg_ctl: kill: (776) - No such pid
> postmaster successfully shut down.
>
> when i am giving command
> bash-2.04$ pg_ctl start
> pg_ctl: It seems another postmaster is running. Try to start
> postmaster anyway.
> FATAL: StreamServerPort: bind() failed: No such file or directory
>         Is another postmaster already running on that port?
>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port
>
>
> when i am giving pg_ctl restart
>
> bash-2.04$ pg_ctl restart
> /usr/bin/pg_ctl: kill: (776) - No such pid
> Waiting for postmaster shutting
> down...............................................................pg_
> ctl: postmaster does not shut down
>
> Please tell how to start services in postgres
>
> when i m giving command
>
> [root@imap /root]# service postgresql restart
> Stopping postgresql service:                               [FAILED]
> Checking postgresql installation:                          [  OK  ]
> Starting postgresql service:                               [FAILED]
>
>
> Please help ASAP, as i have to up the application as soon as possible
>
>
> Thanks & Regards:
>
> Nitin Saxena
>
>
>
> On 8/17/07, Douglas Toltzman <doug@oakstreetsoftware.com> wrote:
> PostgreSQL version 7.0 is really, really out of date, but as far as
> I know, it should still work.
>
> I generally use "ps -ax | grep postges" to see if there is a
> postgres process running.  Also, I use "netstat -a" to see open
> sockets and listening servers.
>
> Have you removed the socket file in /tmp and tried to start the
> server?  You may also want to check the server log to see if there
> is any indication of why it crashed.  Once you clean up the residue
> from the server that abended, you'll be able to start it again,
> unless there are serious problems with the database.  I've only
> seen one case where I couldn't get the server restarted, though,
> and that was after a hard drive failure caused corruption in
> several files.  Even then, I was able to recover everything.
>
> BTW: the socket file ("/tmp/.s.PGSQL.5432") will be a hidden file.
> You'll need to "ls -a /tmp" to see it.  You can just "rm -f /
> tmp/.s.PGSQL.5432" as root and that should clean it up for you.
>
> p.s. This is not a bug, and even if it was, I'm sure version 7.0 is
> no longer supported.  You may want to use a different list if you
> require additional assistance.
>
> On Aug 17, 2007, at 10:31 AM, Nitin Saxena wrote:
>
>>
>>
>> I am using postgres 7.0 on linux platform.
>> My java application was running fine ,but i got this message
>>
>> Connection refused. Check that the hostname and port is correct,
>> and that the postmaster is r
>> unning with the -i flag, which enables TCP/IP networking.
>> at org.postgresql.Connection.openConnection(Connection.java:123)
>> at org.postgresql.Driver.connect(Driver.java:116)
>> at java.sql.DriverManager.getConnection(DriverManager.java:517)
>> at java.sql.DriverManager.getConnection (DriverManager.java:177)
>> at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
>> at SendGrpSmpp.run(SendGrpSmpp.java:96)
>>
>>
>> When i am connecting as su via su - postgres
>> at bash: when i give psql Database Name
>>
>> It is giving error:
>>
>> psql: connectDBStart() -- connect() failed: No such file or directory
>>         Is the postmaster running at 'localhost'
>>         and accepting connections on Unix socket '5432'?
>>
>> when i am  using pg_ctl status command:
>>
>> it   gives output:  pg_ctl: postmaster is running (pid: 776)
>> options are:
>> /usr/bin/postmaster
>> -p 5432
>> -D /var/lib/pgsql/data
>> -B 64
>> -b /usr/bin/postgres
>> -i
>> -N 32
>>
>>
>> when i am using pg_ctl stop  it gives
>>
>> /usr/bin/pg_ctl: kill: (776) - No such pid
>> postmaster successfully shut down.
>>
>>
>> when i am using pg_ctl restart it gives
>>
>>
>> bash-2.04$ pg_ctl restart
>> /usr/bin/pg_ctl: kill: (776) - No such pid
>> Waiting for postmaster shutting
>> down...............................................................pg
>> _ctl: postmaster does not shut down
>>
>>
>> when i am giving pg_ctl start:
>>
>> pg_ctl: It seems another postmaster is running. Try to start
>> postmaster anyway.
>> FATAL: StreamServerPort: bind() failed: No such file or directory
>>         Is another postmaster already running on that port?
>>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
>> pg_ctl: Cannot start postmaster. Is another postmaster is running?
>> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.
>>
>>
>> Expecting your kind help on urgent.
>>
>>
>> Regards--
>> NItin Saxena
>
> Douglas Toltzman
> doug@oakstreetsoftware.com
> (910) 526-5938
>
>
>
>
>
>
> --
> NItin Saxena

Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938

Fwd: error while starting database

From
"Nitin Saxena"
Date:
Hi,

When i m using
ps -ax |grep postgres

[root@imap /root]# ps -ax |grep postgres
  994 tty1     S      0:00 su - postgres

when i am using

 netstat -a , it gives

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:32768                 *:*                     LISTEN
tcp        0      0 *:shell                 *:*                     LISTEN
tcp        0      0 *:time                  *:*                     LISTEN
tcp        0      0 *:8007                  *:*                     LISTEN
tcp        0      0 *:netbios-ssn           *:*                     LISTEN
tcp        0      0 *:pop3                  *:*                     LISTEN
tcp        0      0 *:imap                  *:*                     LISTEN
tcp        0      0 *:finger                *:*                     LISTEN
tcp        0      0 *:sunrpc                *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:ftp                   *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:telnet                *:*                     LISTEN
tcp        0      0 *:smtp                  *:*                     LISTEN
tcp        0      0 10.2.0.48:http          192.168.255.10:35046
TIME_WAIT
tcp        0    138 10.2.0.48:telnet        10.1.65.25:4468
ESTABLISHED
udp        0      0 *:32768                 *:*
udp        0      0 10.2.0.48:netbios-ns    *:*
udp        0      0 *:netbios-ns            *:*
udp        0      0 10.2.0.48:netbios-dgm   *:*
udp        0      0 *:netbios-dgm           *:*
udp        0      0 *:680                   *:*
udp        0      0 *:tftp                  *:*
udp        0      0 *:sunrpc                *:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     1405   /dev/gpmctl
unix  10     [ ]         DGRAM                    776    /dev/log
unix  2      [ ]         DGRAM                    9828
unix  2      [ ]         DGRAM                    1556
unix  2      [ ]         DGRAM                    1417
unix  2      [ ]         DGRAM                    1386
unix  2      [ ]         DGRAM                    1032
unix  2      [ ]         DGRAM                    973
unix  2      [ ]         DGRAM                    821
unix  2      [ ]         DGRAM                    785
unix  2      [ ]         STREAM     CONNECTED     525

Please help as it is urgent.

Regards:

Nitin Saxena
91-9899995709

---------- Forwarded message ----------
From: Nitin Saxena <nitinmca05@gmail.com>
Date: Aug 18, 2007 8:42 AM
Subject: Re: [BUGS] error while starting database
To: Douglas Toltzman <doug@oakstreetsoftware.com>, pgsql-bugs@postgresql.org

Hi

  All the command  such as    gives following output;

  1: :ls -a/tmp: No such file or directory

   2  : "rm -f/tmp/.s.PGSQL.5432"
     bash: rm -f/tmp/.s.PGSQL.5432: No such file or directory

  3:"ps -ax|grep postgres"
    bash: ps -ax|grep postgres: command not found


Does PID in postmaster.pid  file is automatically created when we start the
database.

When i am giving command pg_ctl status at root, It is giving error message
as

pg_ctl: No database directory or environment variable $PGDATA is specified


               and

When i am giving command pg_ctl status at bash it is giving postmaster is
running

[root@imap /root]# su - postgres
bash-2.04$ pg_ctl status
pg_ctl: postmaster is running (pid: 776)
options are:
/usr/bin/postmaster
-p 5432
-D /var/lib/pgsql/data
-B 64
-b /usr/bin/postgres
-i
-N 32

When i am giving command  at root directory:

[root@imap /root]# pg_ctl stop
pg_ctl: No database directory or environment variable $PGDATA is specified

[root@imap /root]# su - postgres
bash-2.04$ pg_ctl stop
/usr/bin/pg_ctl: kill: (776) - No such pid
postmaster successfully shut down.

when i am giving command
bash-2.04$ pg_ctl start
pg_ctl: It seems another postmaster is running. Try to start postmaster
anyway.
FATAL: StreamServerPort: bind() failed: No such file or directory
        Is another postmaster already running on that port?
        If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
pg_ctl: Cannot start postmaster. Is another postmaster is running?
bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port


when i am giving pg_ctl restart

bash-2.04$ pg_ctl restart
/usr/bin/pg_ctl: kill: (776) - No such pid
Waiting for postmaster shutting
down...............................................................pg_ctl:
postmaster does not shut down

Please tell how to start services in postgres

when i m giving command

[root@imap /root]# service postgresql restart
Stopping postgresql service:                               [FAILED]
Checking postgresql installation:                          [  OK  ]
Starting postgresql service:                               [FAILED]


Please help ASAP, as i have to up the application as soon as possible


Thanks & Regards:

Nitin Saxena



On 8/17/07, Douglas Toltzman <doug@oakstreetsoftware.com> wrote:
>
> PostgreSQL version 7.0 is really, really out of date, but as far as I
> know, it should still work.
>
> I generally use "ps -ax | grep postges" to see if there is a postgres
> process running.  Also, I use "netstat -a" to see open sockets and listening
> servers.
>
> Have you removed the socket file in /tmp and tried to start the server?
> You may also want to check the server log to see if there is any indication
> of why it crashed.  Once you clean up the residue from the server that
> abended, you'll be able to start it again, unless there are serious problems
> with the database.  I've only seen one case where I couldn't get the server
> restarted, though, and that was after a hard drive failure caused corruption
> in several files.  Even then, I was able to recover everything.
>
> BTW: the socket file ("/tmp/.s.PGSQL.5432") will be a hidden file.  You'll
> need to "ls -a /tmp" to see it.  You can just "rm -f /tmp/.s.PGSQL.5432" as
> root and that should clean it up for you.
>
> p.s. This is not a bug, and even if it was, I'm sure version 7.0 is no
> longer supported.  You may want to use a different list if you require
> additional assistance.
>
> On Aug 17, 2007, at 10:31 AM, Nitin Saxena wrote:
>
>
>
> I am using postgres 7.0 on linux platform.
> My java application was running fine ,but i got this message
>
> Connection refused. Check that the hostname and port is correct, and that
> the postmaster is r
> unning with the -i flag, which enables TCP/IP networking.
> at org.postgresql.Connection.openConnection(Connection.java:123)
> at org.postgresql.Driver.connect(Driver.java:116)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection (DriverManager.java:177)
> at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
> at SendGrpSmpp.run(SendGrpSmpp.java:96)
>
>
> When i am connecting as su via su - postgres
> at bash: when i give psql Database Name
>
> It is giving error:
>
> psql: connectDBStart() -- connect() failed: No such file or directory
>         Is the postmaster running at 'localhost'
>         and accepting connections on Unix socket '5432'?
>
> when i am  using pg_ctl status command:
>
> it   gives output:  pg_ctl: postmaster is running (pid: 776)
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
>
> when i am using pg_ctl stop  it gives
>
> /usr/bin/pg_ctl: kill: (776) - No such pid
> postmaster successfully shut down.
>
>
> when i am using pg_ctl restart it gives
>
>
> bash-2.04$ pg_ctl restart
> /usr/bin/pg_ctl: kill: (776) - No such pid
> Waiting for postmaster shutting
> down...............................................................pg_ctl:
> postmaster does not shut down
>
>
> when i am giving pg_ctl start:
>
> pg_ctl: It seems another postmaster is running. Try to start postmaster
> anyway.
> FATAL: StreamServerPort: bind() failed: No such file or directory
>         Is another postmaster already running on that port?
>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.
>
>
> Expecting your kind help on urgent.
>
>
> Regards--
> NItin Saxena
>
>
>    *Douglas Toltzman*
> doug@oakstreetsoftware.com
> (910) 526-5938
>
>
>
>


--
NItin Saxena

--
NItin Saxena

Re: error while starting database

From
"Nitin Saxena"
Date:
Hi

  All the command  such as    gives following output;

  1: :ls -a/tmp: No such file or directory

   2  : "rm -f/tmp/.s.PGSQL.5432"
     bash: rm -f/tmp/.s.PGSQL.5432: No such file or directory

  3:"ps -ax|grep postgres"
    bash: ps -ax|grep postgres: command not found


Does PID in postmaster.pid  file is automatically created when we start the
database.

When i am giving command pg_ctl status at root, It is giving error message
as

pg_ctl: No database directory or environment variable $PGDATA is specified


               and

When i am giving command pg_ctl status at bash it is giving postmaster is
running

[root@imap /root]# su - postgres
bash-2.04$ pg_ctl status
pg_ctl: postmaster is running (pid: 776)
options are:
/usr/bin/postmaster
-p 5432
-D /var/lib/pgsql/data
-B 64
-b /usr/bin/postgres
-i
-N 32

When i am giving command  at root directory:

[root@imap /root]# pg_ctl stop
pg_ctl: No database directory or environment variable $PGDATA is specified

[root@imap /root]# su - postgres
bash-2.04$ pg_ctl stop
/usr/bin/pg_ctl: kill: (776) - No such pid
postmaster successfully shut down.

when i am giving command
bash-2.04$ pg_ctl start
pg_ctl: It seems another postmaster is running. Try to start postmaster
anyway.
FATAL: StreamServerPort: bind() failed: No such file or directory
        Is another postmaster already running on that port?
        If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
pg_ctl: Cannot start postmaster. Is another postmaster is running?
bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port


when i am giving pg_ctl restart

bash-2.04$ pg_ctl restart
/usr/bin/pg_ctl: kill: (776) - No such pid
Waiting for postmaster shutting
down...............................................................pg_ctl:
postmaster does not shut down

Please tell how to start services in postgres

when i m giving command

[root@imap /root]# service postgresql restart
Stopping postgresql service:                               [FAILED]
Checking postgresql installation:                          [  OK  ]
Starting postgresql service:                               [FAILED]


Please help ASAP, as i have to up the application as soon as possible


Thanks & Regards:

Nitin Saxena



On 8/17/07, Douglas Toltzman <doug@oakstreetsoftware.com> wrote:
>
> PostgreSQL version 7.0 is really, really out of date, but as far as I
> know, it should still work.
>
> I generally use "ps -ax | grep postges" to see if there is a postgres
> process running.  Also, I use "netstat -a" to see open sockets and listening
> servers.
>
> Have you removed the socket file in /tmp and tried to start the server?
> You may also want to check the server log to see if there is any indication
> of why it crashed.  Once you clean up the residue from the server that
> abended, you'll be able to start it again, unless there are serious problems
> with the database.  I've only seen one case where I couldn't get the server
> restarted, though, and that was after a hard drive failure caused corruption
> in several files.  Even then, I was able to recover everything.
>
> BTW: the socket file ("/tmp/.s.PGSQL.5432") will be a hidden file.  You'll
> need to "ls -a /tmp" to see it.  You can just "rm -f /tmp/.s.PGSQL.5432" as
> root and that should clean it up for you.
>
> p.s. This is not a bug, and even if it was, I'm sure version 7.0 is no
> longer supported.  You may want to use a different list if you require
> additional assistance.
>
> On Aug 17, 2007, at 10:31 AM, Nitin Saxena wrote:
>
>
>
> I am using postgres 7.0 on linux platform.
> My java application was running fine ,but i got this message
>
> Connection refused. Check that the hostname and port is correct, and that
> the postmaster is r
> unning with the -i flag, which enables TCP/IP networking.
> at org.postgresql.Connection.openConnection(Connection.java:123)
> at org.postgresql.Driver.connect(Driver.java:116)
> at java.sql.DriverManager.getConnection(DriverManager.java:517)
> at java.sql.DriverManager.getConnection(DriverManager.java:177)
> at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
> at SendGrpSmpp.run(SendGrpSmpp.java:96)
>
>
> When i am connecting as su via su - postgres
> at bash: when i give psql Database Name
>
> It is giving error:
>
> psql: connectDBStart() -- connect() failed: No such file or directory
>         Is the postmaster running at 'localhost'
>         and accepting connections on Unix socket '5432'?
>
> when i am  using pg_ctl status command:
>
> it   gives output:  pg_ctl: postmaster is running (pid: 776)
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
>
> when i am using pg_ctl stop  it gives
>
> /usr/bin/pg_ctl: kill: (776) - No such pid
> postmaster successfully shut down.
>
>
> when i am using pg_ctl restart it gives
>
>
> bash-2.04$ pg_ctl restart
> /usr/bin/pg_ctl: kill: (776) - No such pid
> Waiting for postmaster shutting
> down...............................................................pg_ctl:
> postmaster does not shut down
>
>
> when i am giving pg_ctl start:
>
> pg_ctl: It seems another postmaster is running. Try to start postmaster
> anyway.
> FATAL: StreamServerPort: bind() failed: No such file or directory
>         Is another postmaster already running on that port?
>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.
>
>
> Expecting your kind help on urgent.
>
>
> Regards--
> NItin Saxena
>
>
> *Douglas Toltzman*
> doug@oakstreetsoftware.com
> (910) 526-5938
>
>
>
>


--
NItin Saxena

Re: error while starting database

From
Douglas Toltzman
Date:
Since you do not have a /tmp folder in your filesystem, it may be
that the server cannot create the socket file and so it will not
start.  You cannot telnet to port 5432, because no service is
listening on that port.  The PostgreSQL server is not started.

I'm sorry I didn't answer you last night.  It was 02:00 in the
morning when I got home and sent you the previous message, I went
straight to bed after checking my mail.  In any case, the server
specifically calls out an error creating "/tmp/.s.PGSQL.5432".  I
would start by creating a world-writable /tmp folder.  If that allows
you to start the service, then you can do a backup with pg_dumpall.

On Aug 18, 2007, at 12:20 AM, Nitin Saxena wrote:

> Hi,
>
> When i m using
> ps -ax |grep postgres
>
> [root@imap /root]# ps -ax |grep postgres
>   994 tty1     S      0:00 su - postgres
>
> when i am using
>
>  netstat -a , it gives
>
> Active Internet connections (servers and established)
> Proto Recv-Q Send-Q Local Address           Foreign Address
> State
> tcp        0      0 *:32768                 *:*
> LISTEN
> tcp        0      0 *:shell                 *:*
> LISTEN
> tcp        0      0 *:time                  *:*
> LISTEN
> tcp        0      0 *:8007                  *:*
> LISTEN
> tcp        0      0 *:netbios-ssn           *:*
> LISTEN
> tcp        0      0 *:pop3                  *:*
> LISTEN
> tcp        0      0 *:imap                  *:*
> LISTEN
> tcp        0      0 *:finger                *:*
> LISTEN
> tcp        0      0 *:sunrpc                *:*
> LISTEN
> tcp        0      0 *:http                  *:*
> LISTEN
> tcp        0      0 *:ftp                   *:*
> LISTEN
> tcp        0      0 *:ssh                   *:*
> LISTEN
> tcp        0      0 *:telnet                *:*
> LISTEN
> tcp        0      0 *:smtp                  *:*
> LISTEN
> tcp        0      0 10.2.0.48:http          192.168.255.10:35046
> TIME_WAIT
> tcp        0    138 10.2.0.48:telnet        10.1.65.25:4468
> ESTABLISHED
> udp        0      0 *:32768                 *:*
> udp        0      0 10.2.0.48:netbios-ns    *:*
> udp        0      0 *:netbios-ns            *:*
> udp        0      0 10.2.0.48:netbios-dgm   *:*
> udp        0      0 *:netbios-dgm           *:*
> udp        0      0 *:680                   *:*
> udp        0      0 *:tftp                  *:*
> udp        0      0 *:sunrpc                *:*
> Active UNIX domain sockets (servers and established)
> Proto RefCnt Flags       Type       State         I-Node Path
> unix  2      [ ACC ]     STREAM     LISTENING     1405   /dev/gpmctl
> unix  10     [ ]         DGRAM                    776    /dev/log
> unix  2      [ ]         DGRAM                    9828
> unix  2      [ ]         DGRAM                    1556
> unix  2      [ ]         DGRAM                    1417
> unix  2      [ ]         DGRAM                    1386
> unix  2      [ ]         DGRAM                    1032
> unix  2      [ ]         DGRAM                    973
> unix  2      [ ]         DGRAM                    821
> unix  2      [ ]         DGRAM                    785
> unix  2      [ ]         STREAM     CONNECTED     525
>
> Please help as it is urgent.
>
> Regards:
>
> Nitin Saxena
> 91-9899995709
>
> ---------- Forwarded message ----------
> From: Nitin Saxena <nitinmca05@gmail.com>
> Date: Aug 18, 2007 8:42 AM
> Subject: Re: [BUGS] error while starting database
> To: Douglas Toltzman <doug@oakstreetsoftware.com>, pgsql-
> bugs@postgresql.org
>
> Hi
>
>   All the command  such as    gives following output;
>
>   1: :ls -a/tmp: No such file or directory
>
>    2  : "rm -f/tmp/.s.PGSQL.5432"
>      bash: rm -f/tmp/.s.PGSQL.5432: No such file or directory
>
>   3:"ps -ax|grep postgres"
>     bash: ps -ax|grep postgres: command not found
>
>
> Does PID in postmaster.pid  file is automatically created when we
> start the database.
>
> When i am giving command pg_ctl status at root, It is giving error
> message as
>
> pg_ctl: No database directory or environment variable $PGDATA is
> specified
>
>
>                and
>
> When i am giving command pg_ctl status at bash it is giving
> postmaster is running
>
> [root@imap /root]# su - postgres
> bash-2.04$ pg_ctl status
> pg_ctl: postmaster is running (pid: 776)
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
> When i am giving command  at root directory:
>
> [root@imap /root]# pg_ctl stop
> pg_ctl: No database directory or environment variable $PGDATA is
> specified
>
> [root@imap /root]# su - postgres
> bash-2.04$ pg_ctl stop
> /usr/bin/pg_ctl: kill: (776) - No such pid
> postmaster successfully shut down.
>
> when i am giving command
> bash-2.04$ pg_ctl start
> pg_ctl: It seems another postmaster is running. Try to start
> postmaster anyway.
> FATAL: StreamServerPort: bind() failed: No such file or directory
>         Is another postmaster already running on that port?
>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port
>
>
> when i am giving pg_ctl restart
>
> bash-2.04$ pg_ctl restart
> /usr/bin/pg_ctl: kill: (776) - No such pid
> Waiting for postmaster shutting
> down...............................................................pg_
> ctl: postmaster does not shut down
>
> Please tell how to start services in postgres
>
> when i m giving command
>
> [root@imap /root]# service postgresql restart
> Stopping postgresql service:                               [FAILED]
> Checking postgresql installation:                          [  OK  ]
> Starting postgresql service:                               [FAILED]
>
>
> Please help ASAP, as i have to up the application as soon as possible
>
>
> Thanks & Regards:
>
> Nitin Saxena
>
>
>
>
> On 8/17/07, Douglas Toltzman <doug@oakstreetsoftware.com > wrote:
> PostgreSQL version 7.0 is really, really out of date, but as far as
> I know, it should still work.
>
> I generally use "ps -ax | grep postges" to see if there is a
> postgres process running.  Also, I use "netstat -a" to see open
> sockets and listening servers.
>
> Have you removed the socket file in /tmp and tried to start the
> server?  You may also want to check the server log to see if there
> is any indication of why it crashed.  Once you clean up the residue
> from the server that abended, you'll be able to start it again,
> unless there are serious problems with the database.  I've only
> seen one case where I couldn't get the server restarted, though,
> and that was after a hard drive failure caused corruption in
> several files.  Even then, I was able to recover everything.
>
> BTW: the socket file ("/tmp/.s.PGSQL.5432") will be a hidden file.
> You'll need to "ls -a /tmp" to see it.  You can just "rm -f /
> tmp/.s.PGSQL.5432" as root and that should clean it up for you.
>
> p.s. This is not a bug, and even if it was, I'm sure version 7.0 is
> no longer supported.  You may want to use a different list if you
> require additional assistance.
>
> On Aug 17, 2007, at 10:31 AM, Nitin Saxena wrote:
>
>>
>>
>> I am using postgres 7.0 on linux platform.
>> My java application was running fine ,but i got this message
>>
>> Connection refused. Check that the hostname and port is correct,
>> and that the postmaster is r
>> unning with the -i flag, which enables TCP/IP networking.
>> at org.postgresql.Connection.openConnection(Connection.java:123)
>> at org.postgresql.Driver.connect(Driver.java:116)
>> at java.sql.DriverManager.getConnection(DriverManager.java:517)
>> at java.sql.DriverManager.getConnection (DriverManager.java:177)
>> at SendGrpSmpp.readSMPPtable(SendGrpSmpp.java:219)
>> at SendGrpSmpp.run(SendGrpSmpp.java:96)
>>
>>
>> When i am connecting as su via su - postgres
>> at bash: when i give psql Database Name
>>
>> It is giving error:
>>
>> psql: connectDBStart() -- connect() failed: No such file or directory
>>         Is the postmaster running at 'localhost'
>>         and accepting connections on Unix socket '5432'?
>>
>> when i am  using pg_ctl status command:
>>
>> it   gives output:  pg_ctl: postmaster is running (pid: 776)
>> options are:
>> /usr/bin/postmaster
>> -p 5432
>> -D /var/lib/pgsql/data
>> -B 64
>> -b /usr/bin/postgres
>> -i
>> -N 32
>>
>>
>> when i am using pg_ctl stop  it gives
>>
>> /usr/bin/pg_ctl: kill: (776) - No such pid
>> postmaster successfully shut down.
>>
>>
>> when i am using pg_ctl restart it gives
>>
>>
>> bash-2.04$ pg_ctl restart
>> /usr/bin/pg_ctl: kill: (776) - No such pid
>> Waiting for postmaster shutting
>> down...............................................................pg
>> _ctl: postmaster does not shut down
>>
>>
>> when i am giving pg_ctl start:
>>
>> pg_ctl: It seems another postmaster is running. Try to start
>> postmaster anyway.
>> FATAL: StreamServerPort: bind() failed: No such file or directory
>>         Is another postmaster already running on that port?
>>         If not, remove socket node (/tmp/.s.PGSQL.5432) and retry.
>> pg_ctl: Cannot start postmaster. Is another postmaster is running?
>> bash-2.04$ /usr/bin/postmaster: cannot create UNIX stream port.
>>
>>
>> Expecting your kind help on urgent.
>>
>>
>> Regards--
>> NItin Saxena
>
> Douglas Toltzman
> doug@oakstreetsoftware.com
> (910) 526-5938
>
>
>
>
>
>
> --
> NItin Saxena
>
> --
> NItin Saxena

Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938

Re: error while starting database

From
Gregory Stark
Date:
"Douglas Toltzman" <doug@oakstreetsoftware.com> writes:

> In any case, the server specifically calls out an error creating
> "/tmp/.s.PGSQL.5432". I would start by creating a world-writable /tmp
> folder.

FWIW the correct permissions for /tmp on Unix machines is 1777. It should look
like this (note the "t" in place of the last "x"):

$ ls -ld /tmp
drwxrwxrwt 8 root root 12288 Aug 18 16:30 /tmp

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

Re: error while starting database

From
Tom Lane
Date:
"Nitin Saxena" <nitinmca05@gmail.com> writes:
>   All the command  such as    gives following output;

>   1: :ls -a/tmp: No such file or directory

>    2  : "rm -f/tmp/.s.PGSQL.5432"
>      bash: rm -f/tmp/.s.PGSQL.5432: No such file or directory

The reason these commands aren't working for you is you're not putting any
space between the switch and the filename.  I suggest doing some basic
studying of Unix command line stuff...

            regards, tom lane

Re: error while starting database

From
Douglas Toltzman
Date:
All I can tell you, based on this information, Nitin, is that your
postmaster is not started, and it is failing to start for some
reason.  Without any additional information, there is absolutely
nothing I can tell you.  Try listing the /var/lib/pgsql/data folder.
Verify that it does exist and that it does contain the postgres
configuration files, at least.

I don't have time to teach you everything you need to know to
administer a Un*x system or to be a DBA.  If you were encountering a
specific error, I'm sure someone could help you isolate it.  However,
this is the bugs list, as I pointed out before, it is not the correct
list for determining how to configure your server.  Once you get the
server started, you should be able to dump your database and upgrade
your software.

On Aug 18, 2007, at 12:40 PM, Nitin Saxena wrote:

> Sir ,
>
> plz reply
>
> regards:
> nitin
>
> On 8/18/07, Nitin Saxena <nitinmca05@gmail.com> wrote:
> Dear Sir,
>
> please find the attached file.:
>
> This error is of boot.log file which i had attach with mail
>
> Aug 18 13:33:19 imap postgresql: Starting postgresql service:  failed
> Aug 18 13:39:21 imap postgresql: postmaster shutdown failed
> Aug 18 13:39:23 imap postgresql: Checking postgresql installation:
> succeeded
> Aug 18 13:39:25 imap postgresql: Starting postgresql service:  failed
> Aug 18 13:41:44 imap postgresql: postmaster shutdown failed
> Aug 18 13:41:46 imap postgresql: Checking postgresql installation:
> succeeded
> Aug 18 13:41:48 imap postgresql: Starting postgresql service:  failed
> Aug 18 13:49:01 imap postgresql: postmaster shutdown failed
> Aug 18 13:49:03 imap postgresql: Checking postgresql installation:
> succeeded
> Aug 18 13:49:05 imap postgresql: Starting postgresql service:  failed
> Aug 18 14:44:56 imap postgresql: postmaster shutdown failed
> Aug 18 14:44:58 imap postgresql: Checking postgresql installation:
> succeeded
> Aug 18 14:45:00 imap postgresql: Starting postgresql service:  failed
>
> output of different commands
>
> [root@imap /]# pg_ctl status
> /usr/bin/pg_ctl: [: -lt: unary operator expected
> pg_ctl: postmaster is running (pid: )
> options are:
> /usr/bin/postmaster
> -p 5432
> -D /var/lib/pgsql/data
> -B 64
> -b /usr/bin/postgres
> -i
> -N 32
>
> [root@imap /]# pg_ctl stop
> /usr/bin/pg_ctl: [: -lt: unary operator expected
> kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid |
> job]... or kill -l [sigspec]
> postmaster successfully shut down.
>
> [root@imap /]# pg_ctl start
> pg_ctl: It seems another postmaster is running. Try to start
> postmaster anyway.
> pg_ctl: Cannot start postmaster. Is another postmaster is running?
>
> I dont have postgresql.conf file in any of my directory
>
> I had only pg_hba.conf file.
>
> My application was working fine till yesterday.
>
> plzz  help
>
>
> Regards:
>
> Nitin Saxena
>
>
>
>
>
> On 8/18/07, Douglas Toltzman <doug@oakstreetsoftware.com > wrote:
> At this point, I'd have to have more information to be able to tell
> you what to fix.  Does the server give any reason why it fails to
> start?  There could be a configuration error or a permissions error
> on one of the database configuration files.  Does the server give a
> detailed error message?  Check your error logs, also, for clues.
>
> On Aug 18, 2007, at 11:45 AM, Nitin Saxena wrote:
>
>> Hi,
>>
>> I have done it on my system
>>
>> drwxrwxrwt    2 root     root         4096 Aug 18 19:06 tmp
>>
>>
>> still getting the same error.
>>
>> [root@imap /]# /etc/rc.d/init.d/postgresql restart
>> Stopping postgresql service: FAILED]
>> Checking postgresql installation:   OK  ]
>> Starting postgresql service: FAILED]
>>
>> Now what to do sir?
>>
>> looking forward for your support.
>>
>>
>> Regards
>> Nitin
>>
>>
>>
>> On 8/18/07, Gregory Stark <stark@enterprisedb.com> wrote:
>> "Douglas Toltzman" <doug@oakstreetsoftware.com> writes:
>>
>> > In any case, the server specifically calls out an error creating
>> > "/tmp/.s.PGSQL.5432". I would start by creating a world-
>> writable /tmp
>> > folder.
>>
>> FWIW the correct permissions for /tmp on Unix machines is 1777. It
>> should look
>> like this (note the "t" in place of the last "x"):
>>
>> $ ls -ld /tmp
>> drwxrwxrwt 8 root root 12288 Aug 18 16:30 /tmp
>>
>> --
>>   Gregory Stark
>>   EnterpriseDB           http://www.enterprisedb.com
>>
>>
>>
>> --
>> NItin Saxena
>
> Douglas Toltzman
> doug@oakstreetsoftware.com
> (910) 526-5938
>
>
>
>
>
>
> --
> NItin Saxena
>
>
>
> --
> NItin Saxena

Douglas Toltzman
doug@oakstreetsoftware.com
(910) 526-5938