Обсуждение: How to check whether PostgreSQL server is up and running?

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

How to check whether PostgreSQL server is up and running?

От
Jan Muhammad
Дата:
Hi,

After having various error message in starting PostgreSQL version 8.2.11; finally uninstalled/deleted it. Now trying my luck on  8.3.7, but things haven't changed for me.
When I try to check that postmaster server is running or not? I get the following error:
$ postmaster -D /usr/local/pgsql/data
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
.......................................................................
Similarly when I try to start postgres server with
[postgres@callisto postgresql-8.3.7]$ pg_ctl -D pg8 start
postgres cannot access the server configuration file "/usr/local/pgsql/postgresql-8.3.7/pg8/postgresql.conf": No such file or directory
server starting

Have no idea what's wrong and where the problem is? Do I need to change/edit some of Environment variable settings or what? Or should I reinstall PostgreSQL with Yum?? Or should give up using PostgreSQL and switch to some other DB like MySQL etc... No idea what to do.....?

Thanks in advance for help.

-Jan Muhammad


Re: How to check whether PostgreSQL server is up and running?

От
Michael Monnerie
Дата:
On Freitag 08 Mai 2009 Jan Muhammad wrote:
> After having various error message in starting PostgreSQL version
> 8.2.11; finally uninstalled/deleted it. Now trying my luck on  8.3.7,
> but things haven't changed for me. When I try to check that
> postmaster server is running or not? I get the following error: $
> postmaster -D /usr/local/pgsql/data
> LOG:  could not translate host name "localhost", service "5432" to
> address: Name or service not known WARNING:  could not create listen
> socket for "localhost"
> FATAL:  could not create any TCP/IP sockets
> .....................................................................
>... Similarly when I try to start postgres server with
> [postgres@callisto postgresql-8.3.7]$ pg_ctl -D pg8 start
> postgres cannot access the server configuration file
> "/usr/local/pgsql/postgresql-8.3.7/pg8/postgresql.conf": No such file
> or directory

This smells a lot like SElinux. Do you use SElinux? Try disabling it.

mfg zmi
--
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4


Вложения

Re: How to check whether PostgreSQL server is up and running?

От
Tom Lane
Дата:
Michael Monnerie <michael.monnerie@is.it-management.at> writes:
> On Freitag 08 Mai 2009 Jan Muhammad wrote:
>> postmaster -D /usr/local/pgsql/data
>> LOG:� could not translate host name "localhost", service "5432" to
>> address: Name or service not known

> This smells a lot like SElinux.

No, it looks like his DNS setup is broken.  Not being able to translate
"localhost" to "127.0.0.1" will break most networking services, not
only Postgres ...

            regards, tom lane

Re: How to check whether PostgreSQL server is up and running?

От
"dayat"
Дата:
Ok let's to create a cluster for you, be sure the pg8 directory owned by postgres user and the directory is empty.
 
[postgres@callisto]$ initdb -D /usr/local/pgsql/postgresql-8.3.7/pg8 -U postgres -W
 
Type your password if they ask, wait initdb process until finish.
 
And try the server:
[postgres@callisto]$ pg_ctl -D /usr/local/pgsql/postgresql-8.3.7/pg8 start
 
enter to database postgres with user postgres and type your password
[postgres@callisto]$ psql postgres postgres -W
 
Tell me if this not work.
 
Regards
Hidayat
 
----- Original Message -----
Sent: Friday, May 08, 2009 4:11 PM
Subject: [ADMIN] How to check whether PostgreSQL server is up and running?

Hi,

After having various error message in starting PostgreSQL version 8.2.11; finally uninstalled/deleted it. Now trying my luck on  8.3.7, but things haven't changed for me.
When I try to check that postmaster server is running or not? I get the following error:
$ postmaster -D /usr/local/pgsql/data
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
.......................................................................
Similarly when I try to start postgres server with
[postgres@callisto postgresql-8.3.7]$ pg_ctl -D pg8 start
postgres cannot access the server configuration file "/usr/local/pgsql/postgresql-8.3.7/pg8/postgresql.conf": No such file or directory
server starting

Have no idea what's wrong and where the problem is? Do I need to change/edit some of Environment variable settings or what? Or should I reinstall PostgreSQL with Yum?? Or should give up using PostgreSQL and switch to some other DB like MySQL etc... No idea what to do.....?

Thanks in advance for help.

-Jan Muhammad


Re: How to check whether PostgreSQL server is up and running?

От
Jan Muhammad
Дата:
Hi,

Got it working now, though after several searches and hit-n-trials....

The problem was in my "/pgsql/data/pg_hba.conf"; where it needed my machine's IP.
Now got it working.

But the real issue of service is not yet being recognized  with in the command:
# service postgresql status
postgresql: unrecognized service
Or even:
#service pg_ctl status
pg_ctl: unrecognized service

And strange is  when I do:
# /sbin/service --status-all
I can see among other service (pg_ctl) running:
pg_ctl: server is running (PID: 29330)
/usr/local/pgsql/bin/postgres "-i" "-D" "/usr/local/pgsql/data"


Don't know what is/was issue; but anyways Thanks for helping.

Regards

-Jan Muhammad
--- On Fri, 5/8/09, dayat <sql.muda@yahoo.co.id> wrote:

From: dayat <sql.muda@yahoo.co.id>
Subject: Re: [ADMIN] How to check whether PostgreSQL server is up and running?
To: pgsql-admin@postgresql.org
Date: Friday, May 8, 2009, 9:42 PM

Ok let's to create a cluster for you, be sure the pg8 directory owned by postgres user and the directory is empty.
 
[postgres@callisto]$ initdb -D /usr/local/pgsql/postgresql-8.3.7/pg8 -U postgres -W
 
Type your password if they ask, wait initdb process until finish.
 
And try the server:
[postgres@callisto]$ pg_ctl -D /usr/local/pgsql/postgresql-8.3.7/pg8 start
 
enter to database postgres with user postgres and type your password
[postgres@callisto]$ psql postgres postgres -W
 
Tell me if this not work.
 
Regards
Hidayat
 
----- Original Message -----
Sent: Friday, May 08, 2009 4:11 PM
Subject: [ADMIN] How to check whether PostgreSQL server is up and running?

Hi,

After having various error message in starting PostgreSQL version 8.2.11; finally uninstalled/deleted it. Now trying my luck on  8.3.7, but things haven't changed for me.
When I try to check that postmaster server is running or not? I get the following error:
$ postmaster -D /usr/local/pgsql/data
LOG:  could not translate host name "localhost", service "5432" to address: Name or service not known
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
.......................................................................
Similarly when I try to start postgres server with
[postgres@callisto postgresql-8.3.7]$ pg_ctl -D pg8 start
postgres cannot access the server configuration file "/usr/local/pgsql/postgresql-8.3.7/pg8/postgresql.conf": No such file or directory
server starting

Have no idea what's wrong and where the problem is? Do I need to change/edit some of Environment variable settings or what? Or should I reinstall PostgreSQL with Yum?? Or should give up using PostgreSQL and switch to some other DB like MySQL etc... No idea what to do.....?

Thanks in advance for help.

-Jan Muhammad



Re: How to check whether PostgreSQL server is up and running?

От
Scott Marlowe
Дата:
On Fri, May 8, 2009 at 11:28 AM, Jan Muhammad <janmuhd@yahoo.com> wrote:
> Hi,
>
> Got it working now, though after several searches and hit-n-trials....
>
> The problem was in my "/pgsql/data/pg_hba.conf"; where it needed my
> machine's IP.
> Now got it working.
>
> But the real issue of service is not yet being recognized  with in the
> command:
> # service postgresql status
> postgresql: unrecognized service

Did you install postgresql as an RPM package?  The service command in
redhat is designed to work with /etc/init.d/ scripts that are
installed by proper rpm packages.  The service script that comes with
a source install is NOT designed to work properly with that specific
package.  If you want service to work properly, I'd recommend sticking
to the PGDG redhat packages, it makes life much easier, especially for
beginners.

Snip

> Have no idea what's wrong and where the problem is? Do I need to change/edit
> some of Environment variable settings or what? Or should I reinstall
> PostgreSQL with Yum?? Or should give up using PostgreSQL and switch to some
> other DB like MySQL etc... No idea what to do.....?

Yes install with yum or rpm.  If you want to have real fun, try
installing mysql from source.