Thread: psqsl -> remote db
I'm sorry, I'm sure I should be asking this someplace more general, but apparantly the word 'port' is used in so many different contexts that a google search turns up fruitless ;) I'm just trying to access a remote postgresql database on port 5432, which does not appear to be open on the remote computer. I'm on a MacOSX and cannot figure out for the life of me how to open up this port on the computer. This is probably a unix question if anything, but any help would be apprecaited. -Andrew
> I'm just trying to access a remote postgresql database on port 5432, > which does not appear to be open on the remote computer. I'm on a > MacOSX and cannot figure out for the life of me how to open up this > port on the computer. It's not clear what kind is the remote machine. Is it a Mac? If so, and its firewall is on, you may need to open up port 5432. If you have physical access to that machine, you can do this in System Preferences -> Sharing -> Firewall. I can give more details if necessary. - John D. Burger MITRE
What machine is remote? Linux? Solaris? or Mac? I couldn't tell if the remote system or your workstation was a Mac. I will assume the postgresql server is on a Mac, and that the Mac has its firewall enabled. On my Mac, to open a firewall for something like this, go to System Preferences, and then click Sharing. There you should see a Firewall button - click to display the firewall settings. Scroll through the Allow list and make sure there is not already an entry for PostgreSQL. If there is, make sure it is checked. If not, click the New... button. Enter a port name ("PostgreSQL"), and enter "5432" in the TCP Ports field. [I do not believe postgresql uses UDP.] Click OK. Then make sure the PostgreSQL port was added to the Allow list and is checked. Close System Preferences, and answer Yes to save, if prompted. That should be it, the mac should now allow incoming traffic on PostgreSQL's port. If the remote computer is not a Mac, the instructions above will not work. Are you sure the remote postgresql server has been configured to listen on port 5432 ? By default, postgresql often will not listen to TCP connections unless explicitly instructed to do so. Depending on how postgresql is installed, it could be that it just isn't listening for a network connection, only allowing local connections. On Aug 4, 2005, at 11:26 AM, Andrew Stewart wrote: > I'm sorry, I'm sure I should be asking this someplace more general, > but apparantly the word 'port' is used in so many different > contexts that a google search turns up fruitless ;) > > I'm just trying to access a remote postgresql database on port > 5432, which does not appear to be open on the remote computer. I'm > on a MacOSX and cannot figure out for the life of me how to open > up this port on the computer. > This is probably a unix question if anything, but any help would be > apprecaited. > > -Andrew > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >
First, makes sure the PostgreSQL database is listening for TCP/IP connections on the computer you're trying to connect to. On Mac OS X, run this command in the a terminal, i.e. Terminal.app: netstat -l You should see a line like this somewhere in the output: tcp6 0 0 *.5432 *.* LISTEN Second, the database server's pg_hba.conf likely needs to be configured to accept connections from remote users. This can be done to restrict connections from specific hosts (IP addresses), which isn't terribly practical, or by user and encrypted password. Search the PostgreSQL document site for "pg_hba.conf" for info. Third, if the database server is listening, and it is configured to allow you to connect, try connecting with psql: psql -h myhost.com -U me mydb "myhost.com" can be an IP address. Type "man psql" to see what the options mean. I hope this helps. Jim > I'm sorry, I'm sure I should be asking this someplace more general, but > apparantly the word 'port' is used in so many different contexts that a > google search turns up fruitless ;) > > I'm just trying to access a remote postgresql database on port 5432, > which does not appear to be open on the remote computer. I'm on a > MacOSX and cannot figure out for the life of me how to open up this > port on the computer. > > This is probably a unix question if anything, but any help would be > apprecaited. > > -Andrew > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > ----- James Cradock, jcradock@me3.com
jcradock@me3.com wrote: >First, makes sure the PostgreSQL database is listening for TCP/IP >connections on the computer you're trying to connect to. On Mac OS X, run >this command in the a terminal, i.e. Terminal.app: > >netstat -l > >You should see a line like this somewhere in the output: > >tcp6 0 0 *.5432 *.* LISTEN > >Second, the database server's pg_hba.conf likely needs to be configured to >accept connections from remote users. This can be done to restrict >connections from specific hosts (IP addresses), which isn't terribly >practical, or by user and encrypted password. Search the PostgreSQL >document site for "pg_hba.conf" for info. > >Third, if the database server is listening, and it is configured to allow >you to connect, try connecting with psql: > >psql -h myhost.com -U me mydb > >"myhost.com" can be an IP address. Type "man psql" to see what the options >mean. > >I hope this helps. > >Jim > > > >>I'm sorry, I'm sure I should be asking this someplace more general, but >>apparantly the word 'port' is used in so many different contexts that a >>google search turns up fruitless ;) >> >>I'm just trying to access a remote postgresql database on port 5432, >>which does not appear to be open on the remote computer. I'm on a >>MacOSX and cannot figure out for the life of me how to open up this >>port on the computer. >> >>This is probably a unix question if anything, but any help would be >>apprecaited. >> >>-Andrew >> >> >> I'm not a Mac user, but don't they have a firewall by default? Maybe useful? http://cfm.gs.washington.edu/security/firewall/osx-10.1-ipfw/ -- **************************** Daniel Armbrust Biomedical Informatics Mayo Clinic Rochester daniel.armbrust(at)mayo.edu http://informatics.mayo.edu/
On 8/4/05 2:26 PM, "Andrew Stewart" <astew@wam.umd.edu> wrote: > I'm sorry, I'm sure I should be asking this someplace more general, but > apparantly the word 'port' is used in so many different contexts that a > google search turns up fruitless ;) > > I'm just trying to access a remote postgresql database on port 5432, > which does not appear to be open on the remote computer. I'm on a > MacOSX and cannot figure out for the life of me how to open up this > port on the computer. > > This is probably a unix question if anything, but any help would be > apprecaited. You'll probably have to let us know some more details. Can you connect while on the machine that the database is running on? How are you trying to connect from the MacOS machine (show us the command)? What output do you get (again, just paste the output of the command)? Sean