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.

postgresql remote access

Discussion in 'General Discussion' started by webicom, Mar 21, 2006.

  1. webicom

    webicom Well-Known Member

    Joined:
    Mar 30, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Slovenia
    Hello everyone!

    Since I had so many problems solving this issue I would like to help others to solve it qoicker than I did. The issue is remote access to postgresql data base version 8.0.x. Please excuse me if my english is bad (Im from EU Slovenia). This tutorila is for "dummys" so I will describe how to solve the issue step by step.

    Server type Linux Fedora 4

    Path to pgsql config: /var/lib/pgsql/data

    PART 1 (edit postgresql.conf)

    1. Edit postgresql.conf where
    #listen_addresses = 'localhost'
    change to
    listen_addresses = '*'

    2. Edit postgresql.conf where
    #port = 5432
    change to
    port = 5432
    as you can see if sign # it means that is not inclouded in directive. If we remove the sign # the directive is set.

    3. Edit postgresql.conf where
    #max_connections = 32 (no. 32 can be diferent)
    change to
    max_connections = 32 (yu can set no 32 or any other as you wish)

    4. Close and save postgresql.conf

    PART 2 (edit pg_hba.conf)

    1.Edit pg_hba.conf where
    # IPv4 local connections:
    under that line add
    host database_name all 2xx.xx.xx.xx/24 md5 (where 2xx.xx... it means put the IP for wich you whant to allow remote access). Line # IPv4 local connections: can be found at the bottom of the pg_hba.conf file.

    2. Close and save pg_hba.conf

    3. If you did everything right your pg_hba.conf file at the bottom should look something like this:

    # TYPE DATABASE USER CIDR-ADDRESS METHOD

    # "local" is for Unix domain socket connections only
    local all all ident sameuser
    # IPv4 local connections:
    host all all 127.0.0.1/32 ident sameuser
    host database_name all 2xx.xx.xx.xx/24 md5
    # IPv6 local connections:
    host all all ::1/128 ident sameuser

    PART 3

    1. Restart Postgresql server. You can do it through WHM or use SSH command
    service postgresql restart

    2. If adding new data base you will need to add remote access permission for it. Use tutorial from PART 2, point 1. and restart postgresql server.

    3. Of course, you need to open port 5432 in your firewall or nothing will work.

    THE END

    I hope it helps someone. I wish you good luck to you all outhere...

    Regards, Erik
     
  2. iCARus

    iCARus Well-Known Member

    Joined:
    Apr 8, 2003
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Well, we have problems. We can connect only thru Cpanel, but from remote we stuck.

    We have :

    It works only with this rule:

    We use the laster postgreSQL with latest stable Cpanel/WHM.

    Anyone got idea what we're doing wrong ?

    Thank you.
     
  3. webicom

    webicom Well-Known Member

    Joined:
    Mar 30, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Slovenia
    Did you try exactly the same as

    # "local" is for Unix domain socket connections only
    local all all ident sameuser
    # IPv4 local connections:
    host all all 127.0.0.1/32 ident sameuser
    host database_name all 2xx.xx.xx.xx/24 md5
    # IPv6 local connections:
    host all all ::1/128 ident sameuser

    Where 2xx.xx.xx.xx change to IP of the remote computer with wich you are trying to connect.

    Regards, Erik
     
  4. Azraell

    Azraell Member

    Joined:
    Aug 2, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brasil / Rio de Janeiro
    #4 Azraell, Aug 15, 2007
    Last edited: Aug 15, 2007
Loading...

Share This Page