postgresql-relay(8) General Commands Manual postgresql-relay(8)
postgresql-relay - multiplex all your databases to one point of origin
postgresql-relay can be used to as a single point of origin for all
your databases. Instead of having to remember (or modify in case of
changes) all the names of your databases, on which machines and on
which ports they are running, you only need to remember one machine and
the name of the database. The postgresql-relay will then forward the
connection to the proper database on the proper port of the proper
server. No more changes in the hundreds of clients and scripts!
Use this configuration file instead of /usr/local/etc/post-
-f Stay in the foreground, don't daemonize. The logging will be
printed to stdout too.
-q Be quiet, don't log anything
-v Be verbose, log a lot.
Each line in the configuration file has five fields, seperated by
The first field is the incoming port for clients. For the easiest con-
figuration on the client-side, keep this all the same (say port 5432 as
the standard postgresql port).
The second field is the name of the database the client wants to con-
nect to. This doesn't have to be the name of the database on the server
The third field is the name of the host the database is located on.
The fourth field is the port the database is listening on.
The fifth field is the name of the database to connect to.
CONFIGURATION FILE EXAMPLES
Say you have two databases, one named mail on the local machine on port
5444 and one named users on the machine foo on port 5445. The configu-
ration file would then be:
With this configuration, Postgresql-relay will listen on port 5432 and
forward connections to the mail and users databases.
Start the relay with a non-standard configuration file and keep it in
postgresql-relay -c /usr/local/etc/postgresql-relay.conf.test -f
Now, in a different terminal, connect to to mail database:
psql -h dbserver -p 5432 -U root mail
postgresql-relay.conf, most likely in /usr/local/etc.
Postgresql-relay supports tcpwrappers. For access to postgresql-relay
the daemon is called postgresql. For access to a database the daemon is
In the following example, the localhost and the hosts in the 10/8 net-
work have access to postgresql-relay, while only the localhost and the
10.10.10.0/8 network have access to the database 'fdc':
postgresql : 10.0.0.0/255.0.0.0 : allow
postgresql : 127.0.0.1 : allow
postgresql : ALL : deny
postgresql-fdc : 10.10.10.0/255.255.255.0 : deny
postgresql-fdc : 127.0.0.1 : allow
postgresql-fdc : ALL : deny
Logging goes to syslog, to the facility daemon.
It would be best practise if the name of the machine on which post-
gresql-relay is running would have an alias in DNS, so that even if the
machine on which postgresql-relay is running changes, the scripts don't
have to be updated. A recommended name is dbrelay.
If the communication protocol version is unknown, it should fail prop-
erly but this hasn't been tested.
Edwin Groothuis, email@example.com (http://www.mavetju.org)
3rd Berkeley Distribution March 22, 2004 postgresql-relay(8)