PDA

View Full Version : Accessing postgres over network



bandy
09-14-2008, 06:14 PM
I have HEM working well on my desktop - that is where postgres is installed. Now I am trying to get it running on my laptop, but am unable to get access to postgres.

FWIW laptop is using Vista - same problem with firewall off. I have been doing this for awhile with PT3, so I know that my laptop has access to postgres.

Did a search of forums but couldn't find the answer. Any suggestions?

morny
09-14-2008, 06:16 PM
I wrote a step by step FAQ for this: http://faq.holdemmanager.com/categories/Frequently+Asked+Questions/PostgreSQL/Run+PostgreSQL+Over+a+Network/

bandy
09-14-2008, 06:27 PM
OK - thanks for the link.

Is it impossible for HEM to access postgres over a network? If not possible is that something that is planned is a future release? I would have thought that this ability would have been a priority.

morny
09-14-2008, 06:35 PM
It is possible and its outlined how to do it via that FAQ

bandy
09-14-2008, 07:34 PM
It is possible and its outlined how to do it via that FAQ

OK I've read it several times and I'm extremely confused.

Your FAQ seems to be meant to set up a database on an external drive that can be plugged to either of 2 computers - which is not what I want.

I'm currently able to access everything on the desktop (postgresql and any databases) with the laptop by starting PT3, so I thought it would be possible with HEM.

morny
09-15-2008, 10:12 AM
This is just something i figured out by asking on the PostgreSQL forums since a couple of people were aksing for it (Me included:p) which gave me a few ideas and i worked it out but i havent tried it exactly the way you done it.

Im not a postgreSQL expert however and just know enough to get it working but id say you can get it working the way you want.

Basically follow those instructions and pretend one of your hard drives either on the laptop or desktop is the external drive, the idea is that postgreSQL is installed on both laptop and PC but the data folder is only stored on one drive.

One thing youll need to consider which isnt a problem when doing it with an external drive is you need to stop the service on one PC while the other is running as id imagine it would cause permission issues possibly but maybe it will work without it.

If you want to post a step by step of what youve done and where youve came across the problem and i might be able to help. Also i found the PostgreSQL forums helpful myself although some people told me the external hard drive way wasnt possible though so maybe post on 2 forums like i did.

bandy
09-15-2008, 10:42 AM
OK Morny I've got it working.

The postgres config files on the desktop had to be amended slightly to allow other computers on the network to access it (I had already done this to allow PT3 to access the db from laptop), and the server address to find the db on the laptop (the screen that pops up when HEM is first launched) had to be changed to the IP of the desktop rather than the IP for postgres.

It's really quite straightforward - here is a link to the complete instructions:

http://www.pokertracker.com/forums/viewtopic.php?f=45&t=4638

Not sure about the political correctness of using that link in this forum, but it does explain everything fairly well. My apologies if anyone is offended.

bandy

morny
09-15-2008, 10:48 AM
Whats PT3:p

bandy
09-15-2008, 10:48 AM
Basically follow those instructions and pretend one of your hard drives either on the laptop or desktop is the external drive, the idea is that postgreSQL is installed on both laptop and PC but the data folder is only stored on one drive.

One thing youll need to consider which isnt a problem when doing it with an external drive is you need to stop the service on one PC while the other is running as id imagine it would cause permission issues possibly but maybe it will work without it.



FYI postgreSQL only has to be installed on one of the computers (in my case the desktop). HEM can be running on both computers, but only one should be auto importing at any time or you risk corrupting the db.

bandy

DK115
09-15-2008, 04:07 PM
Paul,

For a faq:

Compter 1: HM & Postgres Database; make sure that Computer 1 has a static IP adress.
Computer 2 (laptop?) only HM. All hands importing in one DB; use HM on both computers.

Step one:

You need to say to postgres that users from other computers can log in:

On Compter 1 add a line in pg_hba.conf file
like this

host all all 192.168.2.3 255.255.255.255 trust
{where 192.168.2.3 is the ip adress of the laptop}.

If your using DHCP and you do not know the exact IP of the laptop the line will look like this

host all all 192.168.2.0 255.255.255.0 trust
{where 192.168.2.0 is your local network ...}

Step 2:

Then change the line in the postgressql.conf
listen_addresses = 'localhost' into listen_addresses = '*'

Go to services on computer 1 and restart the PostgresSQL service

Step 3:

Go to the firewall confuration on computer 1 and make an exception for port 5432 (if it is not there) for the internal network.

Step 4:
Then start on computer 2 HM and give in the IP adress of Computer/dbserver one where localhost is displayed; the DB on Computer 1 should be found ...

morny
09-15-2008, 06:06 PM
Bandy, when i was saying that i was referring to setting it up to work with an external hard drive so in that case you would need postgreSQL to be installed on both.

DK, thanks a million for this and ill make a FAQ on this during the week.

bandy
09-15-2008, 06:21 PM
Bandy, when i was saying that i was referring to setting it up to work with an external hard drive so in that case you would need postgreSQL to be installed on both.

DK, thanks a million for this and ill make a FAQ on this during the week.

That makes sense morny. Thanks for your help - and nh DK - I'm sure others will be able to use it.

udbrky
10-15-2008, 04:19 AM
I've been trying to get this to work for the last few days.

I have followed the steps in this thread. However, I keep getting an error message on my second computer saying postgres cannot be started, would I like HEM to start it. When I try to create a DB on the local server - 127.0.0.1 it works fine. Postgres is running.

I am running Vista on comp 1 and XP on comp 2. I have comodo firewall and kaspersky antivirus on both.

What steps or settings am I missing?

bandy
10-15-2008, 09:02 AM
I have followed the steps in this thread. However, I keep getting an error message on my second computer saying postgres cannot be started, would I like HEM to start it. When I try to create a DB on the local server - 127.0.0.1 it works fine. Postgres is running.


Have you checked to see if the IP of your main computer is actually 127.0.0.1? You can do this by selecting RUN COMMAND from the start menu and then typing IPCONFIG in the window that opens. The IP address of that computer will be shown - that is the address that must be entered on your second computer when starting HEM/postgres.

DK115
10-15-2008, 10:27 AM
Your IP of your main computer is always 127.0.0.1 but this one can not been used on another computer since 127.0.0.1 alwys point to the own machine (and so 127.0.0.1 point on the second computer to the second computer ...)

To find out the outsight ip adres from the main computer: use ipconfig command on the prompt (type in RUN: cmd, in the screen that appears type: ipconfig) Do this on the main computer: most of the time it is something like 192.168.1.2.

@morny: have you already made a FAQ for this? Found out that editting postgressql.conf and pg_hba.conf is more easy from pgadmin3.exe.

morny
10-15-2008, 11:45 AM
Yeah Thanks for helping with this, ive added it here:

http://208.109.95.123/faq/?f=161

udbrky
10-16-2008, 03:53 AM
Have you checked to see if the IP of your main computer is actually 127.0.0.1? You can do this by selecting RUN COMMAND from the start menu and then typing IPCONFIG in the window that opens. The IP address of that computer will be shown - that is the address that must be entered on your second computer when starting HEM/postgres.

Yes, I put in the IP address on my network for my DB computer - 192.168.1.103, not 127....

bandy
10-16-2008, 08:55 AM
Yes, I put in the IP address on my network for my DB computer - 192.168.1.103, not 127....

That should work - sorry about the confusion with IP addresses.

If it still doesn't work I really don't know what to try next - it may be something to do with your firewall.

udbrky
10-16-2008, 01:22 PM
Ok, I finally figured out what was wrong.

1) Windows Firewall somehow was turned back on. I turned it off.

2) In my config file, I had the addresses listed under ipv6 instead of ipv4. Once I fixed that, it shows right up.

DK115
10-18-2008, 03:02 AM
Glad to hear. You do not have to turn your firewall off. Go to the firewall, got to execptions. Add another port, call it prostgres, and enter portnumber 5432/TCP and it shoudl work. This should be done on the machine with the database.

erptech
05-10-2011, 12:16 PM
I wrote a step by step FAQ for this: http://208.109.95.123/faq/?f=154

could you please update the address of this faq? ty

udbrky
05-10-2011, 12:23 PM
http://faq.holdemmanager.com/categories/Frequently+Asked+Questions/PostgreSQL/Run+PostgreSQL+Over+a+Network/

fixed