The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Postgres says it starts ok, but doesn't!

Discussion in 'General Discussion' started by onaweb, Aug 20, 2004.

  1. onaweb

    onaweb Well-Known Member

    Joined:
    Jan 1, 2004
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    I was having some problems with getting postgres started. When I tried service postgresql start - it would come back that postgresql is an unrecognized service. At the advice of people on this forum, I reinstalled postgresql. When in whm, it states that posgresql started ok, but in service status it still says failed. I have uncommented the tcp and port lines from postgresql.conf and set the tcp = true. I can log in and create a db and user, but when I try to connect to db, I receive an error message Warning: pg_connect(): Unable to connect to PostgreSQL server: unknown host name: localhost.

    Any ideas?

    I would really appreciate any help that anyone can offer.

    Thanks,
    Andy
     
  2. vivek

    vivek Well-Known Member

    Joined:
    Mar 2, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    Hello,

    If postgresql on Cpanel refuses to start even after reinstalling it from /scripts, try the following steps :

    1. Delete the postgre files in /tmp.
    2. rm -rf /var/lib/pgsql/data
    3. su - postgres
    4. initdb
    5. start postgre from ssh
    6. Go back and try the WHM functions again.

    After doing #4 the msg. ends with:

    Success. You can now start the database server using:

    /usr/bin/postmaster -D /var/lib/pgsql/data
    or
    /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

    Chose the first option or start Postgres from WHM.

    If any body else have any suggestion regarding please post the reply or suggest another solution .

    Thank You.
    Vivek
     
  3. onaweb

    onaweb Well-Known Member

    Joined:
    Jan 1, 2004
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    Hello Vivek,
    thanks for your help.

    At step 4, I get this:
    initdb: You must identify where the the data for this database
    system will reside. Do this with either a -D invocation
    option or a PGDATA environment variable.
     
  4. onaweb

    onaweb Well-Known Member

    Joined:
    Jan 1, 2004
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    Got that far, I received the Success message went to start postgres using the /usr/bin/postmaster -D /var/lib/pgsql/data command and it hangs at
    LOG: database system is ready - not sure if this is normal but it doesn't bring me back to a prompt yet.
     
  5. Sheldon

    Sheldon Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    378
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    ive got the same problem...

    havent tried this yet tho!
     
  6. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    hit ctrl-c and then change the postgres password in WHM. Then restart it in WHM.
     
  7. onaweb

    onaweb Well-Known Member

    Joined:
    Jan 1, 2004
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    Now we just took 2 steps back. Now if I try to restart Postgres in WHM I get this:
    postgresql has failed, please contact the sysadmin (result was "postmaster is not running").
     
  8. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    initdb -D /var/lib/pgsql/data

    and restarting it from whm should work.
     
  9. Sheldon

    Sheldon Well-Known Member

    Joined:
    Jun 7, 2004
    Messages:
    378
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    didnt work for me!
     
  10. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    Then try vivek's post again. That is how I have gotten it running on 3 different stubborn servers. Try both
    /usr/bin/postmaster -D /var/lib/pgsql/data
    and
    /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
    to get it started. Once it's running you should be able to change the password and set up the configuration file via WHM. Then you can restart it from WHM. Don't give up. Eventually it will work. :)
     
  11. vivek

    vivek Well-Known Member

    Joined:
    Mar 2, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    Hey casey,

    It works for me perfectly, its not working for other people. hehehehe
    correct me if i have given any incorrect steps for resolving the problem.

    By the way casey where are you from, can we talk in private if you do not mind :)

    Thank You,
    Vivek.
     
  12. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    No, those are the correct steps. That's why I specifically told them to try your solution again. That is exactly how I have fixed it on a few different servers.

    Send me a pm if you wanna chat.
     
  13. mhbrands

    mhbrands Member

    Joined:
    Apr 12, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Kansas
    I had the same problem after the cpanel update. I downgraded back to stable and then rebuilt postgres... works great now :D
     
  14. manghooli

    manghooli Well-Known Member

    Joined:
    Aug 22, 2004
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Thanks, it works perfectly for me :)
    i think, it is useful to turn it to a HOWTO topic :)
     
  15. sv1

    sv1 Well-Known Member

    Joined:
    Aug 31, 2003
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    16
    Worked like a charm!
     
  16. vivek

    vivek Well-Known Member

    Joined:
    Mar 2, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    Any Body Interested ........

    Dear Friends,

    If you have any questions you can send private messages :)

    Thank You,
    Vivek. :D
     
    #16 vivek, Oct 11, 2004
    Last edited: Oct 13, 2004
  17. anup123

    anup123 Well-Known Member

    Joined:
    Mar 29, 2004
    Messages:
    897
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    This Planet
    My server is supported by (though i know a lot of admin stuff myself too :)), by a Bangalore based company which has been outsourced by my service provider for their entire 24X7 Support for all their servers in data center. I don't have to pay anything though (part of the deal).

    Yes on individual basis, their Admin Support and management packages range from 40$ to 950$ a month

    Anup
     
  18. fishfreek

    fishfreek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    238
    Likes Received:
    0
    Trophy Points:
    16
    postgres command line issues

    When we issue the command su - postgres we are prompted for a password. I have yet to figure out what password it wants. It does not accept the password we put in WHM for the postgres password. It does not accept the root password so I am at a loss as to what password it might be wanting/needing.

    If I simply type postgres at the $ prompt I get the following message.

    $postgres

    postgres does not know where to find the database system data. You must specify the directory that contains the database system either by specifying the -D invocation option or by setting the PGDATA environment variable.
     
  19. mhbrands

    mhbrands Member

    Joined:
    Apr 12, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Kansas
    what happens when you type in

    service postgresql restart


    if it tells you postgres doesnt exist, you may have it disabled somehow in WHM, or the file could have corrupted and be unreadable. Check WHM tweak settings first and if it isnt disabled,

    cd /scripts (I am not where I can find the name at the moment) and ls
    look for an install postgres script or a repair postgres script and run that... then go through WHM and give it a password and try su - postgres again.

    Isn't server operation a wonderfully clever way of helping you learn patience? :cool:
     
  20. gemby

    gemby Well-Known Member
    PartnerNOC

    Joined:
    Feb 16, 2002
    Messages:
    182
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Pula, Croatia
    cPanel Access Level:
    DataCenter Provider
    Is there some script for repairing postgres? I noticed that /scripts/easyapache does the trick, so has anybody has knoledge what script is easyapache calls?
     
Loading...

Share This Page