When I try to connect it remotely from the App Server i get this message:
psql: could not connect to server: Connection refused
Is the server running on host "46.38.163.254" and accepting
TCP/IP connections on port 5432?
This is my setting for db.inc for the App Server
<?php
$db_conf = array (
'db' => array (
'DSN' => 'pgsql:dbname=mysource_matrix;host=46.38.163.254',
'user' => 'matrix',
'password' => '',
'type' => 'pgsql',
),
'db2' => array (
'DSN' => 'pgsql:dbname=mysource_matrix;host=46.38.163.254',
'user' => 'matrix',
'password' => '',
'type' => 'pgsql',
),
'db3' => array (
'DSN' => 'pgsql:dbname=mysource_matrix;host=46.38.163.254',
'user' => 'matrix_secondary',
'password' => '',
'type' => 'pgsql',
),
'dbcache' => NULL,
'dbsearch' => NULL,
);
return $db_conf;
?>
This is the setting for the database server - nano /etc/postgresql/8.3/main/pg_hba.conf
local all postgres ident sameuser
# 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 46.38.163.249/32 trust
# IPv6 local connections:
host all all ::1/128 md5
and nano /etc/postgresql/8.3/main/postgresql.conf
listen_addresses = '46.38.163.249, localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
I added this to the IP Table Rule
-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 46.38.163.249 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -s 46.38.163.249 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Both servers are Debian and I have the following installed on:
1. Database Server - Apache2 and PostgresSQL
2. App Server - Apache2, PHP5, Pear, Required Modules, Step 1 Matrix Install