PostgreSQL Server Hosted on a Local Network

PokerTracker 4 version 4.0.x
June 2, 2014
  • Overview

    In certain scenarios you may find that it is not optimal to install the PostgreSQL Server on your local computer.  PokerTracker allows the placement of the PostgreSQL server on any other computer within your local network, examples of these scenarios may include:

    • A dedicated PostgreSQL server
    • Two desktops sharing the same PostgreSQL database
    • PostgreSQL server that resides on the host OS while poker is played inside a Virtual Machine (VM) i.e. Windows VM hosted on a Mac OS X workstation.

    Please be aware that this method is not officially supported by PokerTracker, since it is not recommended we cannot guarantee help in the event that a problem occurs. Since PokerTracker 4 was not developed to support remote database access, you will find some features will not work unless the PostgreSQL database is located on the same computer such as Backup, Restore, database tuning and database maintenance. 

  • Connecting To The PostgreSQL Server

    Your PostgreSQL Server must be configured to allow data to be sent to and from from other servers/computers on your local network.  To connect to this server from another computer on your network, you need to know the server's address.  Follow the instructions from IP Address from the Local Network to determine the address of the computer which is used to host the PostgreSQL server.

  • Configuring The PostgreSQL Server
    • IP Address for the Local Network

      The first step is to determine how your network is setup.

      Microsoft Windows 7 & Vista

      1. Click Start
      2. Type cmd and press enter
      3. When the command prompt appears, type ipconfig

      ‚Äč

      Microsoft XP & 2000

      1. Click Start
      2. Click Run
      3. Type cmd or command
      4. When the command prompt appears, type ipconfig

       

      Apple OS X

      1. ‚ÄčOpen the terminal application inside the utilities folder
      2. When the terminal appears, type ifconfig


      You will now be able to see all of the networking connections on your computer, we are interested in the IP addresses of these connections.  Look for any IP addresses that start with the numbers  192.168.x.x.  (Note: We are most concerned about the 3rd number in the IP address.)

    • Editing the pg_hba.conf Configuration File

      We will now update your PostgreSQL configuration files to let the server know that computers in your same subnet (local network) are allowed access to the SQL server.  

      Open the pg_hba.conf configuration file by clicking  Start -> Programs -> PostgreSQL-> Configuration Files -> pg_hba.conf, or in the folder C:\Program Files\PostgreSQL\9.0\data.  (Replace 9.0 with the version of PostgreSQL that you have.)

      Scroll to the bottom of the file, we are looking for text that is similar to this:

      # TYPE DATABASE USER CIDR-ADDRESS METHOD
      
      # IPv4 local connections:
      host all all 127.0.0.1/32 md5
      # IPv6 local connections:
      #host all all ::1/128 md5

      If the third digit in your computer's IP address is a 0 (zero), then add this line to the bottom of the document, below the text above:

      host all all 192.168.0.0/24 md5

      If the third digit in your computer's IP address is a 1 (one), then add this line to the bottom of the document, below the text above:

      host all all 192.168.1.0/24 md5

      Save the text file to continue. 

    • Editing the postgresql.conf Configuration File

      We will now update a different PostgreSQL configuration file to let the server know that any IP addresses found within the approved subnet (local network) will be allowed access to the SQL server.

       

      Open the postgresql.conf configuration file by clicking  Start -> Programs -> PostgreSQL-> Configuration Files -> postgresql.conf, or in the folder C:\Program Files\PostgreSQL\9.0\data.  (Replace 9.0 with the version of PostgreSQL that you have.)

      Scroll to the bottom of the file and add the following line of text:

      listen_addresses = '*'

       

      This line of text tells your PostgreSQL server to listen on ALL addresses your computer has, not just localhost (which is only accessible from the local computer).

    • Special Note for Apple OS X Users

      To make the changes listed below on a Mac you need to change permissions on the /Library/PostgreSQL/8.4/data folder.  This data folder may instead say 9.0 or 8.3, it represents the version of PostgreSQL that you have installed on your computer. 


      Right click the data folder and choose Get Info.  At the bottom of the info window click the lock symbol to allow changes, then change permissions to Read & Write for everyone.  You can now make the necessary changes to the config files described below, these files are located in the "data" folder.

       

      After you edit the config files you MUST change the permissions back to No Access for everyone, and then you should enable the lock symbol again.

highfalutin