title: setting ip address of database on different server
body: <p>I deployed a sample Rails app to a remote server with postgres hosted on the same server. The database.yml file was like this. </p>
  
  <pre><code>production:
    adapter: postgresql
    encoding: unicode
    database: remotepg_production
    pool: 5
    host: localhost
    username: mrmann
    password: secret
  </code></pre>
  
  <p>Everything worked fine.   I then went into the database.yml file and replaced <code>host: localhost</code> with the ip address of a postgres database on another server <code>host: 178.XXX.XXX</code> like this</p>
  
  <pre><code>production:
    adapter: postgresql
    encoding: unicode
    database: remotepg_production
    pool: 5
    host: 178.XXX.XXX.XXX        #ip address of server with other postgres database
    username: mrmann
    password: secret
  </code></pre>
  
  <p>When I restarted postgres on the server with the Rails app, the sample application now gave me the 'something went wrong' page for Rails. </p>
  
  <p>The username and the password for the username are the same on both dbs.   Can you suggest what the problem might be?  Thanks</p>
  
  <p><strong>Update</strong></p>
  
  <p>These are the settings in pg_hba.conf on the server with the database that I want to connect to. </p>
  
  <pre><code>local   all             postgres                                peer
  local   all             all                                     peer
  host    all             all             127.0.0.1/32            md5
  host    all             all             ::1/128                 md5
  </code></pre>
  
  <p>Fake Rails app IP: 192.241.XXX.X</p>
  
  <p>Fake Database IP: 192.34.XX.XXX</p>