Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PostGreSQL blues

  • 21-10-2002 10:37am
    #1
    Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭


    Hey guys,

    got a minor problem here .....

    if I try to run the psql terminal from a command line I get the following


    psql: connectDBStart() -- connect() failed: No such file or directory
    Is the postmaster running locally
    and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?


    Further .. if I try to restart the postgresql service, nothing happens (ie. no return feedback like "stopping", "starting", "service unrecognised", etc.). I simply get returned to the next command line prompt.

    Anyone got any ideas about how to sort this? I'm not very knowledgeable on admining databases :confused:


Comments

  • Moderators, Social & Fun Moderators Posts: 42,361 Mod ✭✭✭✭Beruthiel


    [edit]: This board isn't a dating club. Take your spam elsewhere.[/edit]

    .logic.


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Originally posted by Lemming


    psql: connectDBStart() -- connect() failed: No such file or directory
    Is the postmaster running locally
    and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?


    Is the postmaster running and what server are you attemtping to connect to? Give us your connect line, and what switches you're using.

    psql -d -h -p -u??

    .logic.


  • Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭Lemming


    Originally posted by logic1
    Is the postmaster running and what server are you attemtping to connect to? Give us your connect line, and what switches you're using.

    psql -d -h -p -u??

    .logic.


    Dumb question ... really, really dumb .. but how do I check if the postmaster is running?

    The server I'm attempting to connect to is on a lan, although for purposes of network traffic, everything is happening to the local host (since its all server-side stuff I need carried out) - if that answers the question about the server connection?

    I'm just using the 'psql' command to connect, since that was what worked before I went away.


  • Closed Accounts Posts: 5,563 ✭✭✭Typedef


    Originally posted by Lemming
    Dumb question ... really, really dumb .. but how do I check if the postmaster is running?

    guess

    bash$ ps -A


  • Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭Lemming


    Originally posted by Typedef
    guess

    bash$ ps -A

    As I said ... very very dumb question :rolleyes:

    I assume that the postmaster actually appears as "postmaster" in the ps list ?


  • Advertisement
  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    If the servers on a LAN then you need to use the psql -h <hostname/ip> to connect to it.

    That's more than likely the prob.

    .logic.


  • Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭Lemming


    Originally posted by logic1
    If the servers on a LAN then you need to use the psql -h <hostname/ip> to connect to it.

    That's more than likely the prob.

    .logic.

    Sorry .logic, I should have made it a little clearer.

    The server is on a LAN, but I'm telnetting into the server and trying to run the psql terminal client.

    The other scenario is that apache (also on this machine) is trying to run a php script which access psql.

    So for all intents and purposes the server is the localhost. If you follow me now?


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Originally posted by Lemming
    Sorry .logic, I should have made it a little clearer.

    The server is on a LAN, but I'm telnetting into the server and trying to run the psql terminal client.

    The other scenario is that apache (also on this machine) is trying to run a php script which access psql.

    So for all intents and purposes the server is the localhost. If you follow me now?

    Ahh I getcha, sorry thought you were trying to access it remotely.

    ps -ef | grep post will check to see if postmaster is running for you.

    Also check your /tmp for remnants of an old psql file which may be causing you probs. If there's one there delete or rename it as it could be a prob with cleantmp.

    [edit]: also if u hace access to the config file u might check what $PGHOST= is set to, usually it should be $PGHOST=localhost[/edit]

    .logic.


  • Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭Lemming


    Okkk ...

    I /think/ I'm getting somewhere now.

    I logged into the postgres superuser account (oddly enough called 'postgres') to run the command $->initdb -D /location/of/data

    my question is this:

    when I run this, I get the following message (which isn't too much of a worry in itself):

    "This database system will be initialized with username "postgres".
    This user will own all the data files and must also own the server process.

    initdb: The directory /var/lib/pgsql/data exists but is not empty.
    If you want to create a new database system, either remove or empty
    the directory /var/lib/pgsql/data or run initdb with
    an argument other than /var/lib/pgsql/data.
    "



    Now, the contents of the /data directory look something like this:

    total 40
    drwx

    8 postgres postgres 4096 May 31 14:41 base/
    drwx
    2 postgres postgres 4096 May 31 14:41 globa/l
    -rw
    1 postgres postgres 7522 Apr 15 2002 pg_hba.conf
    -rw
    1 postgres postgres 1118 Oct 29 2001 pg_ident.conf
    -rw
    1 postgres postgres 4 Oct 29 2001 PG_VERSION
    drwx
    2 postgres postgres 4096 Jul 5 15:49 pg_xlog/
    -rw
    1 postgres postgres 3137 Oct 29 2001 postgresql.conf
    -rw
    1 postgres postgres 57 Aug 1 15:56 postmaster.opts
    -rw
    1 postgres postgres 45 Aug 1 15:56 postmaster.pid

    and due to the amount of .conf files, I'm really thinking that deleting the contents of this directory would be a very bad idea.

    On top of that, the "base" directory listed would appear to contain further subdirectories, all integer names, containing masses of files - all with integer names. I suspect that these are the actual user database files.

    eg.

    $-> ls /var/lib/pgsql/data/base -l
    total 24
    drwx

    2 postgres postgres 4096 Nov 15 2001 1/
    drwx
    2 postgres postgres 4096 Aug 7 11:20 161490/
    drwx
    2 postgres postgres 4096 Oct 29 2001 18719/
    drwx
    2 postgres postgres 4096 Jul 2 17:11 18722/
    drwx
    2 postgres postgres 4096 Feb 5 2002 27111/
    drwx
    2 postgres postgres 4096 Jun 17 16:40 35141/


    $-> ls /var/lib/pgsql/data/base/1 -l
    total 1532
    -rw
    1 postgres postgres 0 Oct 29 2001 1215
    -rw
    1 postgres postgres 0 Oct 29 2001 1216
    -rw
    1 postgres postgres 8192 Oct 29 2001 1219
    -rw
    1 postgres postgres 16384 Oct 29 2001 1247
    -rw
    1 postgres postgres 65536 Oct 29 2001 1249

    .........

    -rw
    1 postgres postgres 8192 Oct 29 2001 17276
    -rw
    1 postgres postgres 16384 Oct 29 2001 17288
    -rw
    1 postgres postgres 1904 Nov 15 2001 pg_internal.init
    -rw
    1 postgres postgres 4 Oct 29 2001 PG_VERSION


    Now, does anyone have any idea/experience with postgresql as to which of these locations data was previously written to? Or am I barking up the wrong tree in my attempts to get this working again.


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Okay your PGDATA= variable looks to be pointing /var/lib/pgsql/data but a db has laready been created in this dir so any Data Postgre creates will overwrite this data.

    Best thing to do is run: initdb with a -pgdata value other than /var/lib/pgsql/data - use /var/lib/pgsql/data2 or some such.

    This will intialize and create a new db for you without detroying the old one.

    .logic.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 14,156 ✭✭✭✭Lemming


    Cheers for all the advice type and .logic :)

    Got the service back up a little while ago.

    had to delete the postmaster.pid from the /data directory (since icprm didn't seem to do the job) and then restarted the postmaster service from the postgres superuser account.


Advertisement